perm filename MEMO1.XGP[HAL,HE]1 blob sn#132164 filedate 1974-11-25 generic text, type T, neo UTF8
/LMAR=0/XLINE=4/FONT#0=BASL30.FNT[HAL, HE]/FONT#3=BASI30.FNT[HAL, HE]/FONT#4=BASB30.FNT[XGP,SYS]/FONT#5=BDR40.FNT[XGP,SYS]/FONT#6=LPT.FNT[XGP,SYS]

␈↓ ↓H␈↓STANFORD ARTIFICIAL INTELLIGENCE LABORATORY ␈↓ 	FNOVEMBER 1974
␈↓ ↓H␈↓MEMO AIM-243


␈↓ ↓H␈↓COMPUTER SCIENCE DEPARTMENT
␈↓ ↓H␈↓REPORT CS-456




␈↓ ↓H␈↓␈α?␈α?␈α?␈α5␈↓¬'AL, A Programming System for Automation




␈↓ ↓H␈↓¬␈α?␈α?␈α↓␈↓Raphael Finkel, Russell Taylor, Robert Bolles, Richard Paul, Jerome Feldman␈↓#
*␈↓#








␈↓ ↓H␈↓␈↓ αH'AL,␈αa␈αnew␈αlanguage␈αfor␈αspecification␈αof␈αmanipulatory␈αactions,␈αis␈αdescribed.␈α It
␈↓ ↓H␈↓␈↓ αHis␈αthe␈αmost␈αrecent␈αin␈αa␈αseries␈α
of␈αefforts␈αin␈αthis␈αdirection,␈αa␈αseries␈α
including,␈αin
␈↓ ↓H␈↓␈↓ αHparticular,␈α⊃APT␈α⊂and␈α⊃WAVE.␈α⊃ The␈α⊂'AL␈α⊃system␈α⊂includes␈α⊃a␈α⊃source␈α⊂language
␈↓ ↓H␈↓␈↓ αHwith␈α
advanced␈αfeatures␈α
for␈αdescribing␈α
individual␈αmotions␈α
of␈αmanipulators␈α
and
␈↓ ↓H␈↓␈↓ αHcomplex␈α⊂series␈α⊂of␈α⊃motions␈α⊂making␈α⊂up␈α⊂an␈α⊃entire␈α⊂assembly,␈α⊂and␈α⊃the␈α⊂runtime
␈↓ ↓H␈↓␈↓ αHsystem necessary for execution of programs.






␈↓ ↓H␈↓__________________________________________________________________________________________␈↓ >  

␈↓ ↓H␈↓␈↓β␈↓#
*␈↓# Jerome Feldman is now at the University of Rochester.

␈↓ ↓H␈↓βThis␈α∪research␈α∪was␈α∪supported␈α∪in␈α∪part␈α∪by␈α∪the␈α∪National␈α∪Science␈α∪Foundation␈α∪under␈α∪contract␈α∩No.
␈↓ ↓H␈↓βGI-42906␈α∃and␈α∀in␈α∃part␈α∀by␈α∃the␈α∀Advanced␈α∃Research␈α∀Projects␈α∃Agency␈α∀of␈α∃the␈α∀Office␈α∃of␈α∀Defense
␈↓ ↓H␈↓βunder Contract No. DAHC-15-73-C-0435.

␈↓ ↓H␈↓βThe␈α↔views␈α↔and␈α↔conclusions␈α↔in␈α↔this␈α↔document␈α↔are␈α↔those␈α↔of␈α↔the␈α↔authors␈α↔and␈α↔should␈α↔not␈α⊗be
␈↓ ↓H␈↓βinterpreted␈α∩as␈α∩necessarily␈α∪representing␈α∩the␈α∩official␈α∩policies,␈α∪either␈α∩expressed␈α∩or␈α∩implied,␈α∪of␈α∩the
␈↓ ↓H␈↓βfunding agencies.

␈↓ ↓H␈↓βReproduced␈α in␈α the␈α USA.␈α!Available␈α from␈α the␈α National␈α Technical␈α!Information␈α Service,
␈↓ ↓H␈↓βSpringfield, Virginia 22151.␈↓
␈↓ ↓H␈↓Page ii␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α→FOREWORD␈↓ H



␈↓ ↓H␈↓This␈α
document␈αdescribes␈α
the␈αnew␈α
hand␈αlanguage,␈α
'AL.␈α It␈α
is␈αnot␈α
intended␈αto␈α
be␈αa␈α
final␈αlanguage
␈↓ ↓H␈↓specification␈αor␈α
a␈αuser's␈αmanual.␈α
 Rather,␈αit␈α
is␈αa␈αworking␈α
document␈αpresenting␈α
a␈αnumber␈αof␈α
related
␈↓ ↓H␈↓ideas␈α∂concerning␈α∂a␈α∂system␈α∞for␈α∂programmable␈α∂automation.␈α∂ These␈α∞ideas␈α∂cover␈α∂a␈α∂broad␈α∂range␈α∞of
␈↓ ↓H␈↓topics:␈α∪arm␈α∪servoing,␈α∪parallel␈α∪processing,␈α∪assembly␈α∪world␈α∪modelling,␈α∪strategists,␈α∪and␈α∩language
␈↓ ↓H␈↓design.␈α⊃ We␈α⊃have␈α⊂tried␈α⊃to␈α⊃combine␈α⊂these␈α⊃into␈α⊃a␈α⊂coherent␈α⊃system.␈α⊃ However,␈α⊂as␈α⊃you␈α⊃read␈α⊂this
␈↓ ↓H␈↓document␈α↔you␈α↔will␈α↔notice␈α↔that␈α↔some␈α⊗topics␈α↔have␈α↔been␈α↔explored␈α↔more␈α↔than␈α↔others,␈α⊗some
␈↓ ↓H␈↓explanations␈α
contain␈α∞more␈α
detail␈α
than␈α∞others,␈α
and␈α
some␈α∞questions␈α
are␈α
left␈α∞unanswered.␈α
 Various
␈↓ ↓H␈↓portions of the system have already been implemented.

␈↓ ↓H␈↓Interested␈α
persons␈α∞unfamiliar␈α
with␈α
the␈α∞background␈α
for␈α
this␈α∞work␈α
will␈α
find␈α∞it␈α
useful␈α
to␈α∞read␈α
␈↓βThe
␈↓ ↓H␈↓βUse of Sensory Feedback in a Programmable Assembly System␈↓ [Bolles and Paul].

␈↓ ↓H␈↓We␈α∂would␈α∂like␈α∂to␈α∂thank␈α∂those␈α∂people␈α∂who␈α∂have␈α∂made␈α∂numerous␈α∂suggestions␈α∂and␈α⊂have␈α∂helped
␈↓ ↓H␈↓implement␈α∞various␈α∞parts␈α∞of␈α
the␈α∞system.␈α∞ In␈α∞particular,␈α∞we␈α
would␈α∞to␈α∞thank␈α∞Bertrand␈α∞Meyer,␈α
who
␈↓ ↓H␈↓implemented␈α⊂the␈α⊂scanner␈α⊂and␈α⊂parser,␈α⊂Botond␈α⊂Eross,␈α⊂who␈α⊂is␈α⊂implementing␈α⊂the␈α⊂PDP11␈α∂runtime
␈↓ ↓H␈↓monitor,␈αBruce␈α
Baumgart,␈αwho␈α
assisted␈αwith␈αthe␈α
illustrations,␈αand␈α
Larry␈αTesler,␈α
whose␈αdocument
␈↓ ↓H␈↓preparation␈αprogram␈α
PUB␈αwas␈αused␈α
to␈αprepare␈αthis␈α
paper.␈α We␈α
also␈αwish␈αto␈α
thank␈αD.␈αWhitney,␈α
J.
␈↓ ↓H␈↓Nevins,␈α∞and␈α∞D.␈α∞Killoran␈α∞of␈α
Draper␈α∞Labs␈α∞and␈α∞W.␈α∞Park␈α
of␈α∞Stanford␈α∞Research␈α∞Institute␈α∞for␈α
their
␈↓ ↓H␈↓helpful criticisms and suggestions.

␈↓ ↓H␈↓During␈α
the␈αperiod␈α
in␈αwhich␈α
the␈α
work␈αreported␈α
here␈αwas␈α
performed,␈α
Russ␈αTaylor␈α
was␈αsupported␈α
in
␈↓ ↓H␈↓part␈αby␈αa␈αgrant␈αfrom␈αthe␈αAlcoa␈αFoundation,␈αRaphael␈αFinkel␈αwas␈αsupported␈αby␈αa␈αNSF␈αfellowship,
␈↓ ↓H␈↓and␈α
Robert␈α
Bolles␈α
was␈α
supported␈α
in␈α
part␈α
by␈αthe␈α
Hertz␈α
Foundation.␈α
 We␈α
would␈α
like␈α
to␈α
thank␈αall
␈↓ ↓H␈↓these agencies for their kind assistance.

␈↓ ↓H␈↓The␈αEnglish␈αlanguage␈αhas␈αno␈αgenderless␈αpersonal␈αpronoun;␈αwithout␈αany␈αimplication␈αof␈αsexism␈αwe
␈↓ ↓H␈↓use arbitrary forms in its place.
␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α_TABLE OF CONTENTS␈↓ 
dPage iii



␈↓ ↓H␈↓CHAPTER ␈↓ 
rPAGE

␈↓ ↓H␈↓1  AN OVERVIEW OF 'AL ␈↓ 91
␈↓ ↓H␈↓    1.1  INTRODUCTION ␈↓ 91
␈↓ ↓H␈↓    1.2  PHILOSOPHY AND DESIGN GOALS ␈↓ 92
␈↓ ↓H␈↓        1.2.1  DATA AND CONTROL STRUCTURES ␈↓ 92
␈↓ ↓H␈↓        1.2.2  MOTION SPECIFICATIONS ␈↓ 93
␈↓ ↓H␈↓        1.2.3  USE OF A PLANNING MODEL ␈↓ 93
␈↓ ↓H␈↓        1.2.4  USE OF DOMAIN-SPECIFIC KNOWLEDGE ␈↓ 94
␈↓ ↓H␈↓        1.2.5  THE RUNTIME SYSTEM ␈↓ 95
␈↓ ↓H␈↓        1.2.6  PROGRAMMING AIDS ␈↓ 96
␈↓ ↓H␈↓    1.3  GENERAL SYSTEM OUTLINE ␈↓ 97
␈↓ ↓H␈↓        1.3.1  HARDWARE ␈↓ 97
␈↓ ↓H␈↓        1.3.2  SOFTWARE ␈↓ 97
␈↓ ↓H␈↓    1.4  THE 'AL COMPILER ␈↓ *11
␈↓ ↓H␈↓        1.4.1  PARSER ␈↓ *11
␈↓ ↓H␈↓        1.4.2  EXPANDER   ␈↓ *11
␈↓ ↓H␈↓        1.4.3  TRAJECTORY CALCULATOR ␈↓ *11
␈↓ ↓H␈↓    1.5  USER FEATURES ␈↓ *12
␈↓ ↓H␈↓        1.5.1  PROGRAM FORMULATION ␈↓ *12
␈↓ ↓H␈↓        1.5.2  PROGRAM COMPILATION ␈↓ *13
␈↓ ↓H␈↓        1.5.3  PROGRAM EXECUTION ␈↓ *13

␈↓ ↓H␈↓2  THE BASIC SOURCE LANGUAGE ␈↓ *15
␈↓ ↓H␈↓    2.1  DATA STRUCTURES ␈↓ *15
␈↓ ↓H␈↓        2.1.1  DATA TYPES ␈↓ *15
␈↓ ↓H␈↓        2.1.2  ALGEBRAIC DATA TYPES: SCALARS ␈↓ *15
␈↓ ↓H␈↓        2.1.3  VECTORS ␈↓ *17
␈↓ ↓H␈↓        2.1.4  ROTATIONS ␈↓ *19
␈↓ ↓H␈↓        2.1.5  FRAMES ␈↓ *19
␈↓ ↓H␈↓        2.1.6  PLANES ␈↓ *20
␈↓ ↓H␈↓        2.1.7  TRANSFORMS ␈↓ *21
␈↓ ↓H␈↓        2.1.8  PLANNING VALUES ␈↓ *22
␈↓ ↓H␈↓        2.1.9  ARITHMETIC ␈↓ *22
␈↓ ↓H␈↓        2.1.10  SOME EXAMPLES OF ARITHMETIC EXPRESSIONS ␈↓ *24
␈↓ ↓H␈↓    2.2  MOTIONS ␈↓ *25
␈↓ ↓H␈↓        2.2.1  COMPILE-TIME AND RUNTIME CONSIDERATIONS ␈↓ *25
␈↓ ↓H␈↓        2.2.2  SIMPLE MOVES ␈↓ *26
␈↓ ↓H␈↓        2.2.3  CONDITION MONITORS ␈↓ *26
␈↓ ↓H␈↓        2.2.4  FORCE DURING A MOTION ␈↓ *29
␈↓ ↓H␈↓        2.2.5  DEPROACHES ␈↓ *30
␈↓ ↓H␈↓        2.2.6  OTHER MOTION CLAUSES ␈↓ *32
␈↓ ↓H␈↓        2.2.7  COMPLEX MOVES ␈↓ *33
␈↓ ↓H␈↓        2.2.8  SEARCHES ␈↓ *34
␈↓ ↓H␈↓        2.2.9  CENTER ␈↓ *35
␈↓ ↓H␈↓Page iv␈α?␈α?␈α?␈α?␈α?␈α?␈απTABLE OF CONTENTS␈↓ H



␈↓ ↓H␈↓CHAPTER␈↓ 
rPAGE
␈↓ ↓H␈↓        2.2.10  CONSTANT VELOCITY MOTION ␈↓ *36
␈↓ ↓H␈↓        2.2.11  STOPPING ␈↓ *36
␈↓ ↓H␈↓        2.2.12  DEVICE CONTROL ␈↓ *36
␈↓ ↓H␈↓    2.3  AFFIXMENT ␈↓ *37
␈↓ ↓H␈↓        2.3.1  THE AFFIX STATEMENT ␈↓ *37
␈↓ ↓H␈↓        2.3.2  THE UNFIX STATEMENT ␈↓ *39
␈↓ ↓H␈↓        2.3.3  MOTIONS AND AFFIXMENT ␈↓ *39
␈↓ ↓H␈↓    2.4  GRAPH STRUCTURES ␈↓ *40
␈↓ ↓H␈↓        2.4.1  EXPLICIT MODIFICATIONS TO THE GRAPH STRUCTURE ␈↓ *40
␈↓ ↓H␈↓        2.4.2  GRAPH STRUCTURES AND AFFIXMENT ␈↓ *42
␈↓ ↓H␈↓    2.5  CONTROL STRUCTURES ␈↓ *43
␈↓ ↓H␈↓        2.5.1  TRADITIONAL STRUCTURES ␈↓ *43
␈↓ ↓H␈↓        2.5.2  COBEGIN-COEND ␈↓ *45
␈↓ ↓H␈↓        2.5.3  PARTIAL ORDERING OF SUBTASKS ␈↓ *45
␈↓ ↓H␈↓        2.5.4  EVENTS:  SIGNAL AND WAIT ␈↓ *46
␈↓ ↓H␈↓        2.5.5  STATEMENT CONDITION MONITORS ␈↓ *47
␈↓ ↓H␈↓        2.5.6  COMMENTS ␈↓ *48
␈↓ ↓H␈↓        2.5.7  LABELS ␈↓ *48
␈↓ ↓H␈↓        2.5.8  ABORT ␈↓ *48
␈↓ ↓H␈↓        2.5.9  OUTPUT ␈↓ *49
␈↓ ↓H␈↓        2.5.10  PROCEDURES ␈↓ *49

␈↓ ↓H␈↓3  COMPILE-TIME CONSTRUCTS ␈↓ *52
␈↓ ↓H␈↓    3.1  INTRODUCTION ␈↓ *52
␈↓ ↓H␈↓    3.2  PLANNING VALUES ␈↓ *52
␈↓ ↓H␈↓    3.3  PLANNING VARIABLES ␈↓ *55
␈↓ ↓H␈↓        3.3.1  ALGEBRAIC PLANNING VARIABLES ␈↓ *55
␈↓ ↓H␈↓        3.3.2  ATOMS ␈↓ *56
␈↓ ↓H␈↓        3.3.3  EXPRESSIONS, CLAUSES, STATEMENTS, AND FORMS ␈↓ *57
␈↓ ↓H␈↓    3.4  ASSERTIONS ␈↓ *58
␈↓ ↓H␈↓        3.4.1  THE ASSERT STATEMENT ␈↓ *59
␈↓ ↓H␈↓        3.4.2  THE DENY STATEMENT ␈↓ *60
␈↓ ↓H␈↓        3.4.3  CONSTRAINT ASSERTIONS ␈↓ *60
␈↓ ↓H␈↓        3.4.4  STANDARD USES FOR ASSERTIONS ␈↓ *61
␈↓ ↓H␈↓    3.5  CONDITIONAL EXPANSION ␈↓ *61
␈↓ ↓H␈↓        3.5.1  PLAN IF ␈↓ *61
␈↓ ↓H␈↓        3.5.2  TESTING FOR ASSERTIONS ␈↓ *62
␈↓ ↓H␈↓        3.5.3  THE ANYTHING CONSTRUCT ␈↓ *64
␈↓ ↓H␈↓        3.5.4  BINDING BOOLEANS ␈↓ *64
␈↓ ↓H␈↓        3.5.5  PICK ␈↓ *65
␈↓ ↓H␈↓        3.5.6  PLAN FOREACH ␈↓ *66
␈↓ ↓H␈↓    3.6  THE COMPILE-TIME CHECK STATEMENT ␈↓ *68
␈↓ ↓H␈↓    3.7  LIBRARY ROUTINES ␈↓ *68
␈↓ ↓H␈↓        3.7.1  SAVING LIBRARY ROUTINES ␈↓ *71
␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α_TABLE OF CONTENTS␈↓ 
nPage v



␈↓ ↓H␈↓CHAPTER␈↓ 
rPAGE
␈↓ ↓H␈↓        3.7.2  SAVING AND RESTORING PLANNING VALUES ␈↓ *71

␈↓ ↓H␈↓4  VERY HIGH LEVEL LANGUAGE CAPABILITIES ␈↓ *73
␈↓ ↓H␈↓    4.1  INTRODUCTION  ␈↓ *73
␈↓ ↓H␈↓    4.2  MACRO OPERATIONS AS A `HIGH LEVEL LANGUAGE' ␈↓ *74
␈↓ ↓H␈↓    4.3  MORE POWERFUL PRIMITIVES -- AN OVERVIEW ␈↓ *74
␈↓ ↓H␈↓    4.4  CALLING HIGH LEVEL PRIMITIVES ␈↓ *75
␈↓ ↓H␈↓    4.5  WORLD MODELLING OVERVIEW ␈↓ *77
␈↓ ↓H␈↓    4.6  INFORMATION ABOUT VARIABLES ␈↓ *78
␈↓ ↓H␈↓    4.7  OBJECT DESCRIPTION ␈↓ *80
␈↓ ↓H␈↓        4.7.1  ONE-PIECE OBJECTS ␈↓ *81
␈↓ ↓H␈↓        4.7.2  ASSEMBLIES ␈↓ *86
␈↓ ↓H␈↓    4.8  EXAMPLE: WATERPUMP ASSEMBLY PROGRAM ␈↓ *86

␈↓ ↓H␈↓5  RUNTIME OVERVIEW ␈↓ *92
␈↓ ↓H␈↓    5.1  CONTROL STRUCTURES ␈↓ *92
␈↓ ↓H␈↓    5.2  DATA STRUCTURES ␈↓ *93
␈↓ ↓H␈↓        5.2.1  VALUE CELLS ␈↓ *93
␈↓ ↓H␈↓        5.2.2  GRAPH STRUCTURES ␈↓ *94

␈↓ ↓H␈↓6  EXTENSIONS TO 'AL ␈↓ *95
␈↓ ↓H␈↓    6.1  INCORPORATING VISUAL FEEDBACK ␈↓ *95
␈↓ ↓H␈↓        6.1.1  NECESSARY CAPABILITIES ␈↓ *95
␈↓ ↓H␈↓        6.1.2  STAGES IN INCORPORATING VISUAL FEEDBACK ␈↓ *96
␈↓ ↓H␈↓    6.2  DYNAMIC FRAMES  ␈↓ *97
␈↓ ↓H␈↓    6.3  EXTENSIONS TO OTHER ARMS AND DEVICES ␈↓ *99
␈↓ ↓H␈↓    6.4  FINE CONTROL ␈↓ *99
␈↓ ↓H␈↓    6.5  COLLISION AVOIDING ␈↓ *99

␈↓ ↓H␈↓7  BIBLIOGRAPHY ␈↓ ≠100

␈↓ ↓H␈↓APPENDICES

␈↓ ↓H␈↓I  EXAMPLE DIALOG WITH THE 'AL SYSTEM ␈↓ ≠103

␈↓ ↓H␈↓II  PROGRAMMING EXAMPLES ␈↓ ≠106
␈↓ ↓H␈↓    II.1  BOLTING A BRACKET ONTO A BEAM ␈↓ ≠106
␈↓ ↓H␈↓        II.1.1  EXAMPLE ONE ␈↓ ≠109
␈↓ ↓H␈↓        II.1.2  EXAMPLE TWO ␈↓ ≠111
␈↓ ↓H␈↓        II.1.3  EXAMPLE THREE ␈↓ ≠113
␈↓ ↓H␈↓    II.2  EXAMPLES OF COORDINATED ACTION ␈↓ ≠120
␈↓ ↓H␈↓    II.3  A `VERY HIGH LEVEL' EXAMPLE ␈↓ ≠123

␈↓ ↓H␈↓III  RUNTIME SYSTEM ␈↓ ≠125
␈↓ ↓H␈↓Page vi␈α?␈α?␈α?␈α?␈α?␈α?␈απTABLE OF CONTENTS␈↓ H



␈↓ ↓H␈↓APPENDIX␈↓ 
rPAGE
␈↓ ↓H␈↓    III.1  THE RUNTIME SCHEDULER ␈↓ ≠125
␈↓ ↓H␈↓    III.2  TRAJECTORIES ␈↓ ≠126
␈↓ ↓H␈↓    III.3  JOINT SERVOING ␈↓ ≠126
␈↓ ↓H␈↓    III.4  INTERPRETABLE CODE ␈↓ ≠128
␈↓ ↓H␈↓    III.5  ALGORITHMS FOR USE OF GRAPH STRUCTURE ␈↓ ≠129
␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α
␈↓ 
pPage 1



␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α1␈↓∧CHAPTER 1␈↓
␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α*␈↓¬AN OVERVIEW OF 'AL␈↓





␈↓ ↓H␈↓␈↓∧1.1 INTRODUCTION␈↓

␈↓ ↓H␈↓The␈α∞development␈α∞of␈α∞robot␈α∞manipulators␈α∞such␈α∞as␈α∞the␈α∞"Unimate"␈α∞has␈α∞led␈α∞to␈α∞the␈α∞belief␈α∂that␈α∞these
␈↓ ↓H␈↓tools␈α∩are␈α∪in␈α∩some␈α∪way␈α∩general-purpose␈α∪devices␈α∩and␈α∩that␈α∪they␈α∩might␈α∪be␈α∩programmed␈α∪like␈α∩a
␈↓ ↓H␈↓computer.␈α
 As␈αa␈α
general-purpose␈αprogrammable␈α
device,␈αthe␈α
robot␈αmanipulator␈α
would␈α
provide␈αan
␈↓ ↓H␈↓answer␈α∂to␈α∞the␈α∂need␈α∂for␈α∞automation␈α∂of␈α∞assembly␈α∂in␈α∂batch␈α∞manufacturing␈α∂industries␈α∂where␈α∞small
␈↓ ↓H␈↓production runs eliminate the possibility of special-purpose equipment to increase productivity.

␈↓ ↓H␈↓If␈α
these␈α
robots␈α
are␈α
to␈α
be␈α
programmed,␈αa␈α
language␈α
which␈α
describes␈α
their␈α
actions␈α
must␈αbe␈α
developed.
␈↓ ↓H␈↓This␈α⊃document␈α⊃describes␈α⊃such␈α⊂a␈α⊃language␈α⊃based␈α⊃on␈α⊂the␈α⊃language␈α⊃"WAVE"␈α⊃developed␈α⊃at␈α⊂the
␈↓ ↓H␈↓Stanford Artificial Intelligence Laboratory during the last 5 years.

␈↓ ↓H␈↓The␈αaim␈α
of␈αthis␈αwork␈α
is␈αnot␈αto␈α
provide␈αa␈α"hands␈α
on"␈αfactory␈αfloor␈α
programming␈αsystem␈αbut␈α
rather
␈↓ ↓H␈↓an␈αexperimental␈αlaboratory␈αtool␈αfor␈αinvestigating␈αthe␈αdifficulty,␈αnecessary␈αprogramming␈α
time,␈αand
␈↓ ↓H␈↓feasibility of writing programs to control assembly operations.

␈↓ ↓H␈↓We␈αare␈α
designing␈αa␈αsystem␈α
for␈αsmall␈αscale␈α
batch␈αmanufacturing␈α
where␈αsetup␈αtime␈α
is␈αthe␈αkey␈α
factor.
␈↓ ↓H␈↓We␈αwill␈αrely␈αon␈αa␈αsymbolic␈α
database␈αand␈αpreviously␈αdefined␈αassembly␈αprimitives␈αto␈α
minimize␈αthe
␈↓ ↓H␈↓programming␈α∃time.␈α⊗The␈α∃system␈α∃will␈α⊗be␈α∃capable␈α⊗of␈α∃top␈α∃level␈α⊗planning␈α∃and␈α⊗the␈α∃intelligent
␈↓ ↓H␈↓interpretation of user defined primitives.

␈↓ ↓H␈↓The␈αbatch␈αmanufacturing␈αenvironment␈αis␈αfairly␈αstructured;␈αwe␈αwill␈αmake␈αuse␈αof␈αthis␈αfact␈αto␈αdo␈αas
␈↓ ↓H␈↓much␈α
computation␈α
as␈α
possible␈αbefore␈α
an␈α
assembly␈α
begins.␈αSuch␈α
computation␈α
can␈α
be␈α
done␈αoffline
␈↓ ↓H␈↓and␈α⊂in␈α⊃connection␈α⊂with␈α⊃the␈α⊂data␈α⊃base;␈α⊂during␈α⊃this␈α⊂phase,␈α⊃time␈α⊂will␈α⊃be␈α⊂spent␈α⊃optimizing␈α⊂each
␈↓ ↓H␈↓operation.␈α
 By␈α
performing␈αthis␈α
computation␈α
prior␈αto␈α
the␈α
assembly,␈αthe␈α
amount␈α
of␈αcomputation␈α
that
␈↓ ↓H␈↓the robot must perform for each assembly is reduced.

␈↓ ↓H␈↓This␈α∂new␈α∞language␈α∂"'AL"␈α∞transforms␈α∂the␈α∂machine-language␈α∞style␈α∂of␈α∞program␈α∂of␈α∂"WAVE"␈α∞with
␈↓ ↓H␈↓skips␈α⊃and␈α⊃jumps␈α⊃into␈α⊃a␈α⊃structured␈α∩language␈α⊃resembling␈α⊃Algol.␈α⊃The␈α⊃facility␈α⊃to␈α⊃work␈α∩in␈α⊃many
␈↓ ↓H␈↓different␈αcoordinate␈αsystems␈αand␈αto␈αevaluate␈αgeneral␈αexpressions␈αis␈αadded.␈αThe␈αnew␈αlanguage␈αwill
␈↓ ↓H␈↓provide␈α_for␈α_the␈α_simultaneous␈α_control␈α_of␈α_more␈α_than␈α_one␈α_robot␈α_either␈α→asynchronously␈α_or
␈↓ ↓H␈↓cooperatively.␈αMacro-like␈αroutines␈αmay␈αbe␈αdefined␈αto␈αexpress␈αgeneral-purpose␈αassembly␈α
primitives
␈↓ ↓H␈↓which␈α∂will␈α∂be␈α∞conditionaly␈α∂expanded␈α∂at␈α∂compile␈α∞time.␈α∂ Additional␈α∂data␈α∞may␈α∂be␈α∂added␈α∂to␈α∞these
␈↓ ↓H␈↓routines␈αto␈αenable␈αa␈αtop␈αlevel␈αstrategy␈αprogram␈αto␈αuse␈αthese␈αroutines␈αto␈αaccomplish␈αentire␈α
assembly
␈↓ ↓H␈↓operations.

␈↓ ↓H␈↓The␈α
language␈α
will␈α
allow␈α
a␈α
task␈α
to␈α
be␈αspecified␈α
at␈α
several␈α
different␈α
levels␈α
of␈α
detail,␈α
ranging␈αfrom
␈↓ ↓H␈↓very␈α
explicit␈α
and␈α
detailed␈α∞manipulator␈α
control␈α
programs␈α
to␈α∞programs␈α
written␈α
in␈α
terms␈α∞of␈α
"high-
␈↓ ↓H␈↓level"␈αassembly␈αoperators␈αwhich␈αthe␈αsystem␈αwill␈αthen␈αtranslate␈αinto␈αmanipulator␈αcontrol␈αprograms.
␈↓ ↓H␈↓When␈α∞used␈α∞in␈α∞this␈α∞latter␈α∞mode,␈α∞the␈α∞system␈α∞makes␈α∞extensive␈α∞use␈α∞of␈α∞its␈α∞planning␈α∂model,␈α∞together
␈↓ ↓H␈↓with␈α∩a␈α∩progressive␈α⊃refinement␈α∩strategy␈α∩in␈α⊃order␈α∩to␈α∩produce␈α⊃a␈α∩consistent␈α∩and␈α∩efficient␈α⊃output
␈↓ ↓H␈↓program.
␈↓ ↓H␈↓Page 2␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α¬INTRODUCTION␈↓ $1.1



␈↓ ↓H␈↓The␈α⊃system␈α⊃itself␈α⊃is␈α⊃written␈α⊃in␈α⊃the␈α⊂high␈α⊃level␈α⊃language␈α⊃"SAIL"␈α⊃to␈α⊃facilitate␈α⊃modification␈α⊂and
␈↓ ↓H␈↓change.␈α
We␈α
expect␈α
to␈α
modify␈α
the␈α
language␈α
on␈α
a␈αday-to-day␈α
basis␈α
as␈α
we␈α
start␈α
to␈α
use␈α
it␈α
and␈αgain
␈↓ ↓H␈↓experience.␈α∂ We␈α⊂will␈α∂implement␈α⊂the␈α∂language␈α∂as␈α⊂it␈α∂is␈α⊂defined␈α∂in␈α∂this␈α⊂document,␈α∂and␈α⊂based␈α∂on
␈↓ ↓H␈↓experience we will modify it to obtain a better system.





␈↓ ↓H␈↓␈↓∧1.2 PHILOSOPHY AND DESIGN GOALS␈↓

␈↓ ↓H␈↓A␈α∞full␈α
language␈α∞for␈α
planning␈α∞manipulatory␈α
tasks␈α∞of␈α
the␈α∞complexity␈α
required␈α∞for␈α∞assembly␈α
needs
␈↓ ↓H␈↓many␈α∩features,␈α∩some␈α∩of␈α∩which␈α∩do␈α∩not␈α∩exist␈α∩in␈α∩any␈α∩current␈α∩system.␈α∩ We␈α∩have␈α∪identified␈α∩the
␈↓ ↓H␈↓following interrelated goals.



␈↓ ↓H␈↓␈↓β1.2.1 DATA AND CONTROL STRUCTURES␈↓

␈↓ ↓H␈↓We␈α
believe␈α
that␈α
the␈α
principal␈α
mode␈α
of␈α
input␈α
to␈α
'AL␈α
should␈α
be␈α
textual,␈α
as␈α
opposed␈α
to␈α∞spoken␈α
or
␈↓ ↓H␈↓manual␈α(joystick).␈α There␈αare␈αlevels␈αof␈αcomplexity␈αwhich␈αare␈αmuch␈αmore␈αreadily␈αtransmitted␈αfrom
␈↓ ↓H␈↓man␈αto␈αmachine␈αthrough␈αan␈αinterface␈αof␈αsymbolic␈αtext.␈α Complicated␈αsimultaneous␈αmotions␈αof␈αtwo
␈↓ ↓H␈↓arms␈αand␈αspecifications␈αof␈αtermination␈αand␈α
error␈αconditions␈αare␈αmore␈αlikely␈αto␈α
be␈αunambiguously
␈↓ ↓H␈↓stated␈α⊂through␈α∂the␈α⊂medium␈α∂of␈α⊂text,␈α∂if␈α⊂for␈α⊂no␈α∂other␈α⊂reason␈α∂than␈α⊂the␈α∂structure␈α⊂imposed␈α⊂on␈α∂the
␈↓ ↓H␈↓textual␈α∞language␈α∞forces␈α
a␈α∞consistent␈α∞framework␈α
on␈α∞initially␈α∞less␈α
structured␈α∞intuitive␈α∞ideas.␈α
 Non-
␈↓ ↓H␈↓textual␈α∞forms␈α
of␈α∞input␈α
can␈α∞be␈α
a␈α∞very␈α
useful␈α∞means␈α
for␈α∞defining␈α
target␈α∞locations,␈α∞suggesting␈α
arm
␈↓ ↓H␈↓trajectories␈αdesigned␈αto␈αavoid␈αcollisions,␈αand␈αother␈αpurposes␈αof␈αthis␈αnature.␈α We␈αbelieve,␈αhowever,
␈↓ ↓H␈↓that␈αsuch␈αtools␈α
are␈αmost␈αuseful␈αwhen␈α
applied␈αin␈αconjunction␈αwith␈α
a␈αprogram␈αtext␈α
which␈αsupplies
␈↓ ↓H␈↓the␈αskeletal␈αintent␈αof␈αthe␈αprogrammer;␈αto␈α
this␈αend␈α'AL␈αshould␈αfacilitate␈αuse␈αof␈αsuch␈α
input␈αdevices
␈↓ ↓H␈↓as joysticks and other positioning tools during the process of programming.

␈↓ ↓H␈↓The␈α∞supervisor␈α∞level␈α∞of␈α∂'AL␈α∞should␈α∞be␈α∞simple␈α∞enough␈α∂to␈α∞allow␈α∞natural␈α∞teaching␈α∞by␈α∂showing;␈α∞it
␈↓ ↓H␈↓should␈α∩be␈α∩easy␈α∩to␈α∩interface␈α∩such␈α∩new␈α∩devices␈α∩as␈α∩joysticks␈α∩and␈α∩simple␈α∩vocal␈α∩input␈α∩into␈α∩'AL,
␈↓ ↓H␈↓although we do not intend to do so at present.

␈↓ ↓H␈↓We␈αwant␈αto␈αwrite␈αentire␈αprograms␈αin␈αa␈αnatural␈αmanner.␈α The␈αmachine-language␈αaspect␈αof␈αcurrent
␈↓ ↓H␈↓manipulation␈αlanguages␈αmakes␈αit␈αcumbersome␈αto␈αwrite␈αlong␈αprograms␈αin␈αany␈αstructured␈αway.␈α We
␈↓ ↓H␈↓want␈α⊃a␈α⊃language␈α⊂which␈α⊃lends␈α⊃itself␈α⊂to␈α⊃a␈α⊃more␈α⊂systematic␈α⊃and␈α⊃perspicuous␈α⊃programming␈α⊂style.
␈↓ ↓H␈↓Algol-like control structures are an improvement over assembly-like straight code with jumps.

␈↓ ↓H␈↓Experience␈α∩with␈α⊃languages␈α∩like␈α⊃SAIL␈α∩and␈α⊃WAVE␈α∩has␈α⊃shown␈α∩that␈α⊃text␈α∩macros␈α⊃are␈α∩a␈α⊃useful
␈↓ ↓H␈↓feature;␈α∂they␈α∂reduce␈α∂the␈α∂amount␈α∂of␈α∂repetitive␈α∂typing.␈α∂ 'AL␈α∂should␈α∂have␈α∂a␈α⊂general-purpose␈α∂text
␈↓ ↓H␈↓macro system interfaced into the scanner and parser.

␈↓ ↓H␈↓The␈α
datatypes␈α
available␈αshould␈α
include␈α
those␈α
types␈αnecessary␈α
to␈α
refer␈α
to␈αone-dimensional␈α
measures
␈↓ ↓H␈↓(like␈α∀distance,␈α∀time,␈α∃mass)␈α∀and␈α∀three-dimensional␈α∃measures␈α∀(like␈α∀directed␈α∃distance,␈α∀locations,
␈↓ ↓H␈↓orientations).␈αArithmetic␈αoperators␈αshould␈αbe␈αavailable␈αnot␈αonly␈αfor␈αthe␈αstandard␈αscalar␈αoperations
␈↓ ↓H␈↓like multiplication and addition, but also for such operations as rotation and translation.
␈↓ ↓H␈↓1.2.1␈α?␈α?␈α?␈α?␈α?␈α∂PHILOSOPHY AND DESIGN GOALS␈↓ 
pPage 3



␈↓ ↓H␈↓Simultaneous␈α∀execution␈α∀of␈α∀several␈α∀processes␈α∀should␈α∀be␈α∀available.␈α∀A␈α∀general␈α∃mechanism␈α∀for
␈↓ ↓H␈↓simultaneity␈α∂is␈α∂desired,␈α⊂so␈α∂that␈α∂calculation␈α⊂and␈α∂arm␈α∂motion␈α⊂can␈α∂take␈α∂place␈α⊂simultaneously,␈α∂and
␈↓ ↓H␈↓several manipulators can be in independent motion.



␈↓ ↓H␈↓␈↓β1.2.2 MOTION SPECIFICATIONS␈↓

␈↓ ↓H␈↓Experience␈α∞with␈α∞WAVE␈α∞has␈α∞shown␈α∂that␈α∞calculating␈α∞trajectories␈α∞for␈α∞manipulators␈α∞is␈α∂a␈α∞desirable
␈↓ ↓H␈↓feature,␈α→although␈α→a␈α→time-consuming␈α→one.␈α_Trajectory␈α→calculations,␈α→together␈α→with␈α→all␈α_other
␈↓ ↓H␈↓calculations␈αwhich␈αneed␈αonly␈αbe␈αperformed␈αonce,␈αshould␈αbe␈αdone␈αat␈αcompile␈αtime.␈α This␈αallocation
␈↓ ↓H␈↓of␈α⊃effort␈α⊃can␈α⊃drastically␈α⊃reduce␈α⊃the␈α∩computing␈α⊃load␈α⊃at␈α⊃execution␈α⊃time␈α⊃and␈α∩eliminate␈α⊃wasteful
␈↓ ↓H␈↓recomputation␈α⊂every␈α⊂time␈α⊂a␈α⊂sequence␈α⊂of␈α⊂actions␈α⊂is␈α⊂executed.␈α⊂ This␈α⊂leads␈α⊂to␈α⊂a␈α⊃clear␈α⊂distinction
␈↓ ↓H␈↓between compile-time and runtime.

␈↓ ↓H␈↓The␈α
user␈α
should␈α
be␈α
able␈α
to␈α
demand␈αthat␈α
a␈α
trajectory␈α
pass␈α
through␈α
given␈α
intermediate␈αpoints.␈α
 The
␈↓ ↓H␈↓primary␈α⊃use␈α∩of␈α⊃this␈α∩is␈α⊃to␈α∩avoid␈α⊃collisions␈α⊃during␈α∩the␈α⊃motion.␈α∩ It␈α⊃is␈α∩also␈α⊃useful␈α∩in␈α⊃specifying
␈↓ ↓H␈↓complicated motions.

␈↓ ↓H␈↓A␈α
wide␈αrange␈α
of␈αexceptional␈α
conditions␈αcan␈α
occur␈αduring␈α
the␈αmotion␈α
of␈αa␈α
manipulator:␈αexcessive
␈↓ ↓H␈↓force␈α⊂might␈α∂be␈α⊂exerted,␈α∂a␈α⊂stopping␈α⊂condition␈α∂may␈α⊂be␈α∂met,␈α⊂the␈α⊂arm␈α∂might␈α⊂come␈α∂too␈α⊂close␈α⊂to␈α∂a
␈↓ ↓H␈↓dangerous␈αregion,␈αthe␈αuser␈αmay␈αinterrupt␈αthe␈αmotion␈αmanually,␈αor␈αsome␈αspecified␈αtime␈αlimit␈αmight
␈↓ ↓H␈↓be␈α∞exceeded.␈α
 Appropriate␈α∞action␈α
must␈α∞be␈α
taken␈α∞as␈α∞soon␈α
as␈α∞any␈α
of␈α∞these␈α
occurs,␈α∞for␈α∞example:␈α
to
␈↓ ↓H␈↓start␈αup␈αa␈αnew␈αconcurrent␈αprocess,␈αto␈αterminate␈αsomething␈αalready␈αactive,␈αto␈αnotify␈αthe␈αuser,␈αto␈αfile
␈↓ ↓H␈↓away␈αa␈αstatistic␈αsomewhere␈αin␈αa␈αtable.␈α Therefore,␈α'AL␈αmust␈αallow␈αthe␈αuser␈αflexibility␈αin␈α
specifying
␈↓ ↓H␈↓what␈αconditions␈αto␈αmonitor␈αduring␈αthe␈αcourse␈αof␈αmotions␈α(and␈αduring␈αexecution␈αof␈αblocks␈αof␈αcode
␈↓ ↓H␈↓in␈αgeneral),␈αand␈αwhat␈αto␈αdo␈αin␈αthe␈αcase␈αthat␈αa␈αtested␈αcondition␈αoccurs.␈α It␈αis␈αalso␈αuseful␈αto␈αchange
␈↓ ↓H␈↓the␈αnature␈αof␈αthe␈αtest␈αduring␈αa␈αmotion,␈αif␈αdifferent␈αsegments␈αof␈αthe␈αmotion␈αrequire␈αdifferent␈αtypes
␈↓ ↓H␈↓of␈α
monitoring.␈α This␈α
concept␈αcan␈α
be␈α
generalized␈αto␈α
include␈αthe␈α
modification␈α
of␈αa␈α
motion␈αduring␈α
its
␈↓ ↓H␈↓execution to accomodate to changing conditions.

␈↓ ↓H␈↓We␈α
make␈αthe␈α
assumption␈α
that␈αthreshold␈α
tests␈α
suffice␈αfor␈α
assembly␈α
with␈αsensory␈α
feedback.␈α In␈α
many
␈↓ ↓H␈↓cases,␈αthreshold␈αtests␈αdo␈αsuffice:␈αTo␈αtell␈αif␈αthe␈αarm␈αhas␈αhit␈αsomething,␈αa␈αthreshold␈αtest␈αon␈αdirected
␈↓ ↓H␈↓force␈α
works.␈αTo␈α
tell␈α
if␈αa␈α
screw␈αis␈α
binding,␈α
a␈αsimilar␈α
test␈αserves.␈α
 In␈α
general,␈αhowever,␈α
such␈αtests␈α
lack
␈↓ ↓H␈↓the␈αability␈αto␈αmodify␈αtrajectories␈αon␈αthe␈αbasis␈αof␈αsignal␈αstrength.␈α This␈αlack␈αis␈αonly␈αpartially␈αfilled
␈↓ ↓H␈↓by␈α
an␈α
ability␈α
to␈α
disable␈α
and␈α
enable␈α
condition␈α
monitors␈α
during␈α
the␈α
course␈α
of␈α
a␈α
motion.␈α
 It␈α
is␈α
our
␈↓ ↓H␈↓hope␈α⊂eventually␈α⊂to␈α⊂include␈α⊃the␈α⊂capacity␈α⊂for␈α⊂including␈α⊂devices␈α⊃such␈α⊂as␈α⊂wrist␈α⊂force␈α⊃sensors␈α⊂and
␈↓ ↓H␈↓vision␈α
in␈αthe␈α
servo␈α
control␈αloop␈α
in␈α
a␈αprogrammable␈α
fashion.␈α
 When␈αthese␈α
fascinating␈αprospects␈α
are
␈↓ ↓H␈↓better understood, they will be included in the language.



␈↓ ↓H␈↓␈↓β1.2.3 USE OF A PLANNING MODEL␈↓

␈↓ ↓H␈↓Since␈αlocations␈αare␈αnot␈αknown␈αexactly␈αduring␈αthe␈αplanning␈αof␈αa␈αtrajectory,␈αthere␈αshould␈αbe␈αa␈αclear
␈↓ ↓H␈↓distinction␈α∃between␈α∃planned␈α∃values␈α∃and␈α∃runtime␈α∃values.␈α∃ Planned␈α∃values␈α∃will␈α∃be␈α∃used␈α∀for
␈↓ ↓H␈↓trajectory␈α⊂calculation;␈α⊂at␈α⊂runtime,␈α⊂trajectories␈α⊂will␈α⊂be␈α⊂modified␈α⊂if␈α⊂necessary␈α⊂to␈α⊂account␈α⊃for␈α⊂any
␈↓ ↓H␈↓discrepancies.␈α∞The␈α∞planned␈α
values␈α∞are␈α∞therefore␈α
a␈α∞database␈α∞on␈α
which␈α∞trajectory␈α∞calculations␈α
are
␈↓ ↓H␈↓computed. This database will occasionally be referred to as a ␈↓βworld model␈↓.
␈↓ ↓H␈↓Page 4␈α?␈α?␈α?␈α?␈α6PHILOSOPHY AND DESIGN GOALS␈↓ ∂1.2.3



␈↓ ↓H␈↓Assembly␈αtasks␈αrequire␈α
that␈αone␈αobject␈α
be␈αaffixed␈αto␈αanother.␈α
 We␈αwish␈αto␈α
model␈αthis␈αby␈αhaving␈α
a
␈↓ ↓H␈↓semantic␈α
attachment␈α∞between␈α
objects.␈α∞If␈α
two␈α∞objects␈α
are␈α
affixed,␈α∞and␈α
one␈α∞moves,␈α
the␈α∞second␈α
one
␈↓ ↓H␈↓should␈αmove␈α
accordingly,␈αthat␈αis,␈α
its␈αplanning␈αvalue␈α
should␈αbe␈αproperly␈α
modified.␈αThus,␈αthe␈α
world
␈↓ ↓H␈↓model␈αmust␈α
also␈αinclude␈αinformation␈α
on␈αattachments␈αof␈α
objects,␈αsince␈αthey␈α
will␈αhave␈αan␈α
effect␈αon
␈↓ ↓H␈↓planning␈α⊃values.␈α⊃ The␈α∩affixment␈α⊃concept␈α⊃carries␈α∩over␈α⊃to␈α⊃the␈α∩runtime␈α⊃system,␈α⊃which␈α∩does␈α⊃the
␈↓ ↓H␈↓equivalent␈αmodifications␈αof␈αthe␈αactual␈αvalues.␈α This␈αsaves␈αthe␈αuser␈αuntold␈αbookkeeping␈αoperations
␈↓ ↓H␈↓to determine where an object is after its base has been moved.

␈↓ ↓H␈↓More␈α∂generally,␈α⊂the␈α∂compiler␈α⊂should␈α∂be␈α⊂able␈α∂to␈α∂maintain␈α⊂a␈α∂wide␈α⊂variety␈α∂of␈α⊂information␈α∂about
␈↓ ↓H␈↓expected␈α
runtime␈α
states.␈α
 This␈αincludes␈α
not␈α
only␈α
object␈αaffixments␈α
and␈α
variable␈α
planning␈αvalues,
␈↓ ↓H␈↓as␈αpreviously␈αmentioned,␈αbut␈αalso␈αinformation␈αlike␈αthe␈αaccuracy␈αwithin␈αwhich␈αthe␈αplanning␈αvalue
␈↓ ↓H␈↓is␈α∂known,␈α∞how␈α∂heavy␈α∞an␈α∂object␈α∂is,␈α∞how␈α∂many␈α∞faces␈α∂it␈α∞has␈α∂on␈α∂which␈α∞it␈α∂can␈α∞rest,␈α∂how␈α∂wide␈α∞the
␈↓ ↓H␈↓fingers␈α∂of␈α∂an␈α∂arm␈α⊂should␈α∂open␈α∂to␈α∂grasp␈α∂it.␈α⊂ This␈α∂information␈α∂may␈α∂come␈α∂from␈α⊂several␈α∂sources,
␈↓ ↓H␈↓including␈α⊃explicit␈α⊃assertions␈α⊂by␈α⊃the␈α⊃user,␈α⊂the␈α⊃output␈α⊃of␈α⊂computer-aided␈α⊃design␈α⊃programs,␈α⊂and
␈↓ ↓H␈↓built-in␈αknowledge␈αabout␈αthe␈αsystem␈αhardware.␈α Therefore,␈α'AL␈αshould␈αhave␈αa␈αgeneral␈α
framework
␈↓ ↓H␈↓for representing such knowledge.

␈↓ ↓H␈↓In␈α∂addition␈α∞to␈α∂its␈α∂own␈α∞internal␈α∂uses,␈α∞'AL␈α∂should␈α∂provide␈α∞a␈α∂number␈α∞of␈α∂explicit␈α∂mechanisms␈α∞for
␈↓ ↓H␈↓applying␈α∂this␈α∞information,␈α∂including␈α∞simple␈α∂retrieval␈α∞of␈α∂data␈α∞from␈α∂the␈α∞compile-time␈α∂model␈α∞and
␈↓ ↓H␈↓conditional␈αcompilation␈αfacilities␈αfor␈αproducing␈αsubstantially␈αdifferent␈αobject␈αprograms,␈αdepending
␈↓ ↓H␈↓on␈α∞planning␈α∞information.␈α∞ Such␈α∞facilities␈α∞allow␈α∞the␈α∞user␈α
to␈α∞write␈α∞a␈α∞single␈α∞piece␈α∞of␈α∞code␈α∞in␈α
some
␈↓ ↓H␈↓generality,␈αwhile␈αavoiding␈αthe␈αinefficiencies␈αof␈αmany␈αneedless␈αruntime␈αchecks␈αand␈αthe␈αplanning␈αof
␈↓ ↓H␈↓useless trajectories for cases that will never be executed.



␈↓ ↓H␈↓␈↓β1.2.4 USE OF DOMAIN-SPECIFIC KNOWLEDGE␈↓

␈↓ ↓H␈↓The␈α∞system␈α∞should␈α
have␈α∞enough␈α∞domain-specific␈α
knowledge␈α∞to␈α∞allow␈α
programs␈α∞to␈α∞be␈α∞written␈α
in
␈↓ ↓H␈↓terms␈αof␈αcommon␈αassembly␈αoperations,␈αrather␈αthan␈αexclusively␈αin␈αterms␈αof␈αdetailed␈αsingle␈αmotions.
␈↓ ↓H␈↓At␈αthe␈αsimplest␈αlevel,␈αthis␈αinvolves␈αprovision␈αof␈αa␈αlibrary␈αof␈αcommon␈αassembly␈α"macro-operations"
␈↓ ↓H␈↓that␈α
can␈αbe␈α
conditionally␈αexpanded␈α
to␈αperform␈α
particular␈α
subtasks.␈α Beyond␈α
this,␈αwe␈α
would␈αlike␈α
an
␈↓ ↓H␈↓interactive␈α∞system␈α∞that␈α∞can␈α∞take␈α∞a␈α∞"high␈α∞level"␈α∞description␈α∞of␈α∞an␈α∞assembly␈α∞algorithm␈α∞and␈α∂fill␈α∞in
␈↓ ↓H␈↓many of the detailed decisions required to produce a consistent and efficient output program.

␈↓ ↓H␈↓The␈α∞range␈α
of␈α∞decisions␈α∞required␈α
to␈α∞convert␈α
from␈α∞a␈α∞high␈α
level␈α∞description␈α
to␈α∞an␈α∞efficient␈α
output
␈↓ ↓H␈↓program␈αis␈αquite␈αbroad,␈αand␈αmany␈αof␈αthe␈αprocesses␈αinvolved␈αcannot␈αbe␈αmodelled␈αreadily␈αin␈αterms
␈↓ ↓H␈↓of␈αthe␈αpurely␈αlocal␈αmechanisms␈αused␈αin␈αexpanding␈αlibrary␈αroutines.␈α For␈αinstance,␈αa␈αcommand␈αlike
␈↓ ↓H␈↓"put␈α
the␈α
engine␈α
block␈α
on␈α
the␈α
table␈α∞in␈α
an␈α
upright␈α
position"␈α
might␈α
require␈α
the␈α
system␈α∞to␈α
examine
␈↓ ↓H␈↓future␈α∩operations␈α∩on␈α∩the␈α∩engine␈α∩block␈α∩to␈α∩select␈α∩the␈α∩best␈α∩orientation␈α∩to␈α∩use.␈α∩ Similarly,␈α⊃many
␈↓ ↓H␈↓operations␈α∩produce␈α∩side␈α∩effects␈α∩that␈α∩make␈α∩other␈α∩tasks␈α∩either␈α∩easier␈α∩or␈α∩harder.␈α∪ For␈α∩instance,
␈↓ ↓H␈↓inserting␈α
a␈αpin␈α
into␈α
a␈αhole␈α
yields␈α
information␈αabout␈α
the␈α
exact␈αlocation␈α
of␈α
the␈αhole␈α
and␈αtherefore␈α
of
␈↓ ↓H␈↓the␈α
object␈αinto␈α
which␈α
the␈αhole␈α
has␈α
been␈αdrilled.␈α
 If␈αthere␈α
are␈α
a␈αnumber␈α
of␈α
pins␈αto␈α
be␈αinserted,␈α
then
␈↓ ↓H␈↓it␈α⊂may␈α⊂be␈α⊂a␈α∂good␈α⊂idea␈α⊂to␈α⊂insert␈α⊂pins␈α∂into␈α⊂the␈α⊂easier-to-locate␈α⊂holes␈α∂first␈α⊂and␈α⊂then␈α⊂to␈α⊂use␈α∂the
␈↓ ↓H␈↓information␈α∩so␈α∩gained␈α∪to␈α∩help␈α∩with␈α∪the␈α∩remaining␈α∩insertions.␈α∩(On␈α∪the␈α∩other␈α∩hand,␈α∪such␈α∩an
␈↓ ↓H␈↓ordering␈α∞may␈α∞very␈α∞well␈α∞make␈α∞the␈α∞actual␈α∞insertions␈α∞more␈α∞difficult␈α∞because␈α∞of␈α∞obstructions␈α∞to␈α
the
␈↓ ↓H␈↓hand).␈α
The␈α
system␈αshould␈α
be␈α
familiar␈αwith␈α
such␈α
considerations␈αand␈α
use␈α
them␈αas␈α
it␈α
generates␈αthe
␈↓ ↓H␈↓output program.
␈↓ ↓H␈↓1.2.4␈α?␈α?␈α?␈α?␈α?␈α∂PHILOSOPHY AND DESIGN GOALS␈↓ 
pPage 5



␈↓ ↓H␈↓A␈αuser␈αshould␈αbe␈αable␈αto␈αspecify␈αdifferent␈α
parts␈αof␈αa␈αtask␈αat␈αvarious␈αlevels␈αof␈αdetail.␈α
 The␈αsystem
␈↓ ↓H␈↓must␈α∩be␈α∪able␈α∩to␈α∪accept␈α∩explicit␈α∪advice␈α∩telling␈α∪exactly␈α∩how␈α∪some␈α∩particular␈α∪subtask␈α∩is␈α∪to␈α∩be
␈↓ ↓H␈↓accomplished␈α∞and␈α∞then␈α∞complete␈α∞the␈α∞program␈α∞in␈α
a␈α∞way␈α∞that␈α∞does␈α∞not␈α∞conflict␈α∞with␈α∞those␈α
things
␈↓ ↓H␈↓that␈αhave␈αbeen␈αexplicitly␈α
specified.␈α This␈αis␈αespecially␈αimportant␈α
for␈αearly␈αversions␈αof␈α
'AL,␈αwhich
␈↓ ↓H␈↓are not likely to be very "smart" and will therefore require a fair amount of explicit help.

␈↓ ↓H␈↓The␈α
user␈αshould␈α
be␈αable␈α
to␈α
describe␈αthe␈α
"intent"␈αof␈α
a␈αparticular␈α
piece␈α
of␈αcode,␈α
at␈αleast␈α
to␈αthe␈α
extent
␈↓ ↓H␈↓of␈α⊂specifying␈α⊂any␈α⊂(non-obvious)␈α⊃prerequisites␈α⊂or␈α⊂updates␈α⊂to␈α⊃the␈α⊂world␈α⊂model.␈α⊂ This␈α⊃facility␈α⊂is
␈↓ ↓H␈↓especially␈α⊂important␈α⊂for␈α⊂programs␈α⊂that␈α⊂mix␈α∂both␈α⊂high␈α⊂and␈α⊂low-level␈α⊂primitives.␈α⊂Similarly,␈α∂the
␈↓ ↓H␈↓system␈α⊂should␈α⊂be␈α⊂able␈α⊂to␈α⊂show␈α⊂the␈α⊂user␈α⊂how␈α⊂it␈α⊂is␈α⊂filling␈α⊂in␈α⊂the␈α⊂details␈α⊂to␈α⊂produce␈α⊂an␈α∂output
␈↓ ↓H␈↓program,␈αand␈αwhy.␈αThis␈αis␈α
very␈αimportant␈αboth␈αfor␈αdebugging␈α
and␈αfor␈αexplaining␈αto␈αthe␈αuser␈α
any
␈↓ ↓H␈↓requests for advice that it must make.



␈↓ ↓H␈↓␈↓β1.2.5 THE RUNTIME SYSTEM␈↓

␈↓ ↓H␈↓The␈α
calculation␈αof␈α
trajectories␈α
is␈αtime-consuming␈α
but␈αnot␈α
time-critical;␈α
servoing␈αof␈α
devices␈αis␈α
time-
␈↓ ↓H␈↓critical␈α≤but␈α≤not␈α≤especially␈α≤time-consuming.␈α≤ For␈α≤efficient␈α≤code␈α≥generation,␈α≤modification,
␈↓ ↓H␈↓documentation,␈α∞and␈α
execution,␈α∞we␈α
will␈α∞write␈α
the␈α∞compiler␈α
in␈α∞a␈α
high-level␈α∞language␈α∞and␈α
develop
␈↓ ↓H␈↓and␈α
run␈α
it␈αunder␈α
time-sharing.␈α
 The␈αruntime␈α
programs␈α
will␈α
be␈αwritten␈α
in␈α
either␈αmachine␈α
language
␈↓ ↓H␈↓or␈α∂one␈α∂of␈α∞the␈α∂new␈α∂systems␈α∞implementation␈α∂languages␈α∂(for␈α∞example,␈α∂BLISS),␈α∂since␈α∞time-efficient
␈↓ ↓H␈↓code␈α
must␈αbe␈α
generated.␈α As␈α
one␈αexecution␈α
computer␈α
will␈αbe␈α
required␈αfor␈α
each␈αwork␈α
station␈α
in␈αa
␈↓ ↓H␈↓factory,␈α
and␈α
as␈α
the␈α
runtime␈α
code␈α
and␈α
its␈α
memory␈α
requirements␈α
will␈α
be␈α
quite␈α
small,␈α
we␈α∞will␈α
write
␈↓ ↓H␈↓the␈α∪runtime␈α∪system␈α∪for␈α∪a␈α∪minicomputer.␈α∪ The␈α∩compiler␈α∪could␈α∪also␈α∪be␈α∪written␈α∪for␈α∪the␈α∩small
␈↓ ↓H␈↓computer,␈α⊃but␈α⊃this␈α⊂would␈α⊃compound␈α⊃the␈α⊂problems␈α⊃of␈α⊃writing␈α⊂the␈α⊃compiler;␈α⊃the␈α⊂computational
␈↓ ↓H␈↓requirements␈α
are␈α
much␈α
higher␈α
during␈α
compilation␈α
than␈α
execution,␈α
so␈α
implementing␈α
the␈αcompiler
␈↓ ↓H␈↓on the mini would necessitate either an overly large minicomputer or an overly slow compiler.

␈↓ ↓H␈↓The␈α~runtime␈α~system␈α≠must␈α~support␈α~simultaneous␈α≠executions␈α~of␈α~many␈α≠processes.␈α~ Several
␈↓ ↓H␈↓manipulators␈α∂or␈α∂devices␈α⊂might␈α∂be␈α∂running␈α∂simultaneously,␈α⊂and␈α∂each␈α∂motor␈α∂requires␈α⊂a␈α∂separate
␈↓ ↓H␈↓process;␈α∀several␈α∀condition␈α∀monitors␈α∀might␈α∀be␈α∀active;␈α∀several␈α∀code␈α∀segments␈α∀(doing,␈α∀perhaps,
␈↓ ↓H␈↓calculations)␈α∞might␈α∂be␈α∞simultaneously␈α∞active.␈α∂ Those␈α∞processes␈α∞which␈α∂are␈α∞dealing␈α∂with␈α∞real-time
␈↓ ↓H␈↓devices␈α(joint␈αservos␈α
and␈αcondition␈αcheckers)␈α
must␈αbe␈αguaranteed␈α
service␈αat␈αregular␈α
intervals;␈αthe
␈↓ ↓H␈↓computation␈α∂processes␈α∂can␈α∂fill␈α∂in␈α∂any␈α∂time␈α∂gaps.␈α∂ Thus,␈α∂the␈α∂runtime␈α∂system␈α∂must␈α∂include␈α∂some
␈↓ ↓H␈↓simple implementation of multiple processes under real-time constraints.

␈↓ ↓H␈↓Trajectories␈αare␈αcalculated␈αby␈αthe␈αcompiler␈αon␈αthe␈αbasis␈αof␈αincomplete␈αinformation.␈α At␈αruntime,␈αit
␈↓ ↓H␈↓is␈αnecessary␈αto␈αmodify␈αthose␈αplans␈αto␈αfit␈αthem␈αto␈αthe␈αsomewhat␈αdifferent␈αactual␈αlocation␈αof␈αobjects.
␈↓ ↓H␈↓That␈α∂means␈α∂that␈α∞certain␈α∂information␈α∂must␈α∞be␈α∂carried␈α∂at␈α∞runtime,␈α∂specifically␈α∂the␈α∂locations␈α∞that
␈↓ ↓H␈↓each␈αtrajectory␈αis␈αdesired␈αto␈αpass␈αthrough,␈αthe␈αlocations␈αof␈αall␈αobjects,␈αand␈αhow␈αthey␈α
are␈αattached
␈↓ ↓H␈↓together.

␈↓ ↓H␈↓The␈α∀system␈α∀must␈α∪be␈α∀capable␈α∀of␈α∪using␈α∀vision␈α∀and␈α∪other␈α∀currently␈α∀unimplemented␈α∀forms␈α∪of
␈↓ ↓H␈↓feedback.␈α⊃Vision␈α⊃would␈α⊂be␈α⊃quite␈α⊃useful␈α⊃in␈α⊂searching␈α⊃for␈α⊃objects␈α⊂and␈α⊃testing␈α⊃for␈α⊃adequacy␈α⊂of
␈↓ ↓H␈↓assembly.␈α
It␈α
is␈α
conceivable␈α
that␈α
vision␈α
will␈α
be␈αused␈α
for␈α
the␈α
servoing␈α
of␈α
an␈α
arm;␈α
this␈α
implies␈αthat
␈↓ ↓H␈↓vision␈αwould␈αbe␈αin␈αthe␈αfeedback␈α
loop␈αduring␈αmotions.␈αOther␈αdynamic␈αfeedback␈α(like␈α
force-sensing
␈↓ ↓H␈↓wrists)␈αcould␈αmake␈αthe␈α
capabilities␈αof␈αthe␈αarms␈αmuch␈α
greater␈αin␈αdealing␈αwith␈α
non-rigid␈αmaterials
␈↓ ↓H␈↓Page 6␈α?␈α?␈α?␈α?␈α6PHILOSOPHY AND DESIGN GOALS␈↓ ∂1.2.5



␈↓ ↓H␈↓like␈α
cloth␈α
or␈α
rope.␈α
 What␈α
is␈α
needed␈α
is␈α
a␈α
way␈α
of␈α
specifying␈α
these␈α
"external"␈α
devices␈α
so␈α∞that␈α
when
␈↓ ↓H␈↓they become available, they can be meshed into the system without much difficulty.

␈↓ ↓H␈↓The␈α⊂wide␈α∂range␈α⊂of␈α⊂conceivable␈α∂tasks␈α⊂implies␈α⊂that␈α∂pure␈α⊂hardware␈α⊂servoing␈α∂will␈α⊂not␈α⊂in␈α∂general
␈↓ ↓H␈↓suffice.␈α
 The␈αreason␈α
for␈αthis␈α
is␈α
that␈αhardware␈α
servoing␈αrestricts␈α
use␈α
to␈αone␈α
of␈αa␈α
small␈α
number␈αof
␈↓ ↓H␈↓servo␈α⊗modes␈α⊗(typically␈α↔position,␈α⊗velocity,␈α⊗or␈α↔force),␈α⊗and␈α⊗has␈α↔no␈α⊗provision␈α⊗for␈α↔motions␈α⊗of
␈↓ ↓H␈↓accomodation␈α∀or␈α∀motions␈α∀whose␈α∀modes␈α∀might␈α∀change␈α∀in␈α∀midstream␈α∀due␈α∀to␈α∀some␈α∀software-
␈↓ ↓H␈↓detectable␈α
condition.␈α
 Pure␈α
hardware␈α
servoing␈α
could␈α∞not␈α
be␈α
readily␈α
modified␈α
to␈α
account␈α∞for␈α
new
␈↓ ↓H␈↓feedback␈α⊃devices␈α∩or␈α⊃methods.␈α∩ A␈α⊃philosophy␈α∩of␈α⊃␈↓βsoftware␈α∩servoing␈↓␈α⊃has␈α∩these␈α⊃advantages:␈α∩It␈α⊃is
␈↓ ↓H␈↓possible␈αto␈α
program␈αthe␈α
manner␈αin␈α
which␈αfeedback␈α
is␈αto␈α
be␈αused,␈α
to␈αinterface␈α
new␈αtypes␈αof␈α
sensors,
␈↓ ↓H␈↓to␈αmodify␈αthe␈αservo␈αwhile␈αthe␈αarm␈αis␈αin␈αmotion,␈αto␈αsupply␈αthe␈αdriving␈αprogram␈α
with␈αinformation
␈↓ ↓H␈↓concerning␈α∞the␈α∞success␈α∞of␈α∞the␈α∞motion␈α∞as␈α∞well␈α
as␈α∞to␈α∞keep␈α∞it␈α∞up-to-date␈α∞on␈α∞the␈α∞arm␈α∞status.␈α
 Some
␈↓ ↓H␈↓clearly␈α∃distinguishable␈α∃modes␈α∃of␈α∃servoing␈α∀could␈α∃be␈α∃translated␈α∃into␈α∃hardware;␈α∃however,␈α∀the
␈↓ ↓H␈↓hardware␈α∩becomes␈α∩complicated␈α∩if␈α∩the␈α∩computer␈α∩needs␈α∩to␈α∩be␈α∩able␈α∩to␈α∩switch␈α∩modes␈α∩while␈α⊃the
␈↓ ↓H␈↓program␈α∪is␈α∪being␈α∪executed.␈α∪There␈α∪would␈α∪not␈α∪be␈α∪much␈α∪saving␈α∪in␈α∪compute␈α∪power␈α∪since␈α∪the
␈↓ ↓H␈↓computer␈αwould␈αneed␈α
to␈αperform␈αa␈αservo␈α
calculation␈αin␈αorder␈α
to␈αunderstand␈αwhat␈αthe␈α
manipulator
␈↓ ↓H␈↓is doing and to interact with the task.



␈↓ ↓H␈↓␈↓β1.2.6 PROGRAMMING AIDS␈↓

␈↓ ↓H␈↓A␈αuser␈αshould␈αbe␈αable␈αto␈αwrite␈αa␈αpiece␈αof␈αcode,␈αtry␈αit␈αon␈αthe␈αspot,␈αand␈αdelete␈αor␈αreplace␈αsections␈αof
␈↓ ↓H␈↓previous code.

␈↓ ↓H␈↓The␈αcompiler␈α
should␈αmake␈αa␈α
great␈αnumber␈αof␈α
semantic␈αchecks,␈αsuch␈α
as␈αassuring␈αthat␈α
a␈αproposed
␈↓ ↓H␈↓motion␈α⊂will␈α⊂not␈α⊂hit␈α⊂some␈α⊂object␈α⊂(although␈α⊂this␈α∂is␈α⊂a␈α⊂difficult␈α⊂problem␈α⊂which␈α⊂has␈α⊂not␈α⊂yet␈α∂been
␈↓ ↓H␈↓satisfactorily␈α∂solved)␈α∞or␈α∂that␈α∞simultaneous␈α∂independent␈α∂motions␈α∞are␈α∂not␈α∞being␈α∂requested␈α∂for␈α∞the
␈↓ ↓H␈↓same device.

␈↓ ↓H␈↓'AL␈αshould␈αeventually␈αinclude␈αnon-textual␈αaids␈αto␈αprogramming.␈α For␈αexample,␈αjoysticks␈αmight␈αbe
␈↓ ↓H␈↓used␈α
to␈α
position␈α
heavy␈α
manipulators␈α
prior␈α
to␈αreading␈α
their␈α
locations␈α
and␈α
using␈α
them␈α
in␈αa␈α
program.
␈↓ ↓H␈↓Graphical␈αdisplay␈αcould␈αbe␈αused␈αto␈αto␈αdemonstrate␈αthe␈αplanned␈αlocations␈αof␈αobjects␈αand␈αhow␈αthis
␈↓ ↓H␈↓changes during the course of the program.

␈↓ ↓H␈↓Error␈α∩recovery␈α∪facilities␈α∩are␈α∩very␈α∪important.␈α∩ A␈α∩user␈α∪should␈α∩be␈α∩able␈α∪to␈α∩recover␈α∪from␈α∩errors
␈↓ ↓H␈↓discovered␈α∂during␈α⊂any␈α∂phase␈α∂of␈α⊂debugging.␈α∂ Similarly,␈α∂production␈α⊂programs␈α∂should␈α∂be␈α⊂able␈α∂to
␈↓ ↓H␈↓request␈α∞operator␈α∞intervention␈α∞where␈α∞necessary␈α∞and␈α∞should␈α
(at␈α∞least)␈α∞be␈α∞able␈α∞to␈α∞be␈α∞restarted␈α∞at␈α
a
␈↓ ↓H␈↓convenient place after the problem is fixed.

␈↓ ↓H␈↓There␈αshould␈αbe␈αa␈αway␈α
to␈αinvestigate␈αthe␈αcontents␈αof␈α
the␈αruntime␈αsystem,␈αboth␈αvariables␈αand␈α
code,
␈↓ ↓H␈↓in␈αorder␈αto␈αpatch␈αsimple␈αmistakes␈αdiscovered␈α
during␈αthe␈αcourse␈αof␈αa␈αproduction␈αrun.␈α This␈α
feature
␈↓ ↓H␈↓will be especially useful for debugging the compiler.
␈↓ ↓H␈↓1.3␈α?␈α?␈α?␈α?␈α?␈α?␈α∞GENERAL SYSTEM OUTLINE␈↓ 
pPage 7



␈↓ ↓H␈↓␈↓∧1.3 GENERAL SYSTEM OUTLINE␈↓

␈↓ ↓H␈↓The␈α⊃actual␈α⊃version␈α⊂of␈α⊃'AL␈α⊃which␈α⊃we␈α⊂will␈α⊃implement␈α⊃is␈α⊃related␈α⊂to␈α⊃our␈α⊃current␈α⊃hardware␈α⊂and
␈↓ ↓H␈↓software␈α
capabilities.␈α
 The␈α
following␈αsections␈α
describe␈α
the␈α
overall␈αsystem␈α
from␈α
a␈α
general␈α
point␈αof
␈↓ ↓H␈↓view.



␈↓ ↓H␈↓␈↓β1.3.1 HARDWARE␈↓

␈↓ ↓H␈↓Currently␈α⊃two␈α⊂Stanford␈α⊃Electric␈α⊂Arms,␈α⊃built␈α⊂by␈α⊃Victor␈α⊂Scheinman␈α⊃[Scheinman],␈α⊃are␈α⊂available.
␈↓ ↓H␈↓They␈αare␈αcalled␈αYELLOW␈αand␈αBLUE.␈α Each␈αhas␈αsix␈αjoints␈αand␈αa␈αhand␈αthat␈αcan␈αopen␈αand␈αclose.
␈↓ ↓H␈↓The␈α
joints␈α∞are␈α
controlled␈α
by␈α∞electric␈α
motors;␈α
each␈α∞joint␈α
has␈α
both␈α∞position␈α
and␈α∞velocity␈α
feedback.
␈↓ ↓H␈↓Motor␈α
drives␈α
are␈α
sent␈αfrom␈α
the␈α
computer␈α
to␈α
the␈αarm␈α
via␈α
a␈α
digital-to-analog␈α
converter␈α(D-to-A);
␈↓ ↓H␈↓feedback␈α⊗signals␈α⊗are␈α⊗routed␈α⊗through␈α⊗an␈α⊗analog-to-digital␈α⊗converter␈α⊗(A-to-D)␈α⊗back␈α↔to␈α⊗the
␈↓ ↓H␈↓computer.

␈↓ ↓H␈↓There␈α∂are␈α∞two␈α∂computer-controlled␈α∞cameras.␈α∂The␈α∞computer␈α∂can␈α∞control␈α∂the␈α∞pan,␈α∂tilt,␈α∂focus,␈α∞iris,
␈↓ ↓H␈↓filter, and zoom (or lens turret) on each camera.

␈↓ ↓H␈↓Various␈α
others␈α
devices␈α
are␈α
designed␈α
and␈α
implemented␈αas␈α
needed.␈α
 We␈α
use␈α
tools,␈α
jigs␈α
and␈αspecial
␈↓ ↓H␈↓markings␈αfor␈αseveral␈αpurposes:␈αto␈αrender␈αa␈αtask␈α
possible␈α(an␈αexample␈αis␈αthe␈αarm␈αitself),␈αto␈α
improve
␈↓ ↓H␈↓efficiency␈α⊂(the␈α⊂mechanical␈α⊂screwdriver),␈α⊂and␈α⊂to␈α⊂overcome␈α⊂some␈α⊂of␈α⊂our␈α⊂sensory␈α⊂and␈α∂mechanical
␈↓ ↓H␈↓limitations␈α∀(the␈α∀screw␈α∀dispenser).␈α∀ Currently␈α∪we␈α∀have␈α∀an␈α∀electrically␈α∀powered␈α∀screwdriver,␈α∪a
␈↓ ↓H␈↓pneumatic␈αvise,␈αand␈αan␈αelectrically␈αcontrolled␈αturntable.␈α The␈αscrewdriver␈αcan␈αbe␈αpicked␈αup␈αby␈αan
␈↓ ↓H␈↓arm␈α
and␈αoperates␈α
in␈α
either␈αdirection␈α
over␈α
a␈αrange␈α
of␈α
speeds.␈α The␈α
vise␈α
can␈αbe␈α
opened␈α
or␈αclosed;
␈↓ ↓H␈↓soon␈α⊂there␈α⊂will␈α⊃be␈α⊂a␈α⊂way␈α⊃to␈α⊂servo␈α⊂it␈α⊂to␈α⊃a␈α⊂specified␈α⊂opening.␈α⊃ The␈α⊂computer␈α⊂can␈α⊃position␈α⊂the
␈↓ ↓H␈↓turntable␈αto␈αany␈αrotation␈α(within␈α.5␈αdegrees).␈α As␈αsuch␈αdevices␈αare␈αbuilt,␈αthey␈αwill␈αbe␈αinterfaced␈αto
␈↓ ↓H␈↓the␈α
A-to-D,␈α
the␈α
runtime␈αprograms␈α
told␈α
how␈α
to␈α
control␈αthem,␈α
and␈α
the␈α
language␈α
extended␈αto␈α
include
␈↓ ↓H␈↓syntax to describe how to use them.

␈↓ ↓H␈↓'AL␈αresides␈αon␈αtwo␈αcomputers:␈αThe␈αPDP-10␈αfor␈αall␈αplanning,␈αand␈αa␈αPDP-11/45␈αfor␈αthe␈αexecution
␈↓ ↓H␈↓of␈αthe␈αplans.␈α The␈αformer␈αis␈αrun␈α
as␈αa␈αtimesharing␈αcomputer␈α(under␈αa␈αmodified␈αDEC␈α
system);␈αthe
␈↓ ↓H␈↓latter␈αis␈α
operated␈αin␈αstand-alone␈α
mode␈αunder␈αthe␈α
'AL␈αruntime␈αsystem.␈α
 Each␈αcomputer␈α
is␈αcapable
␈↓ ↓H␈↓of␈α
generating␈α
an␈αinterrupt␈α
in␈α
the␈αother,␈α
and␈α
the␈αPDP-10␈α
has␈α
complete␈αcontrol␈α
over␈α
the␈αPDP-11
␈↓ ↓H␈↓console␈αand␈αunibus.␈α
 It␈αis␈αnot␈α
certain␈αexactly␈αwhat␈α
the␈αminimum␈αruntime␈α
computer␈αconfiguration
␈↓ ↓H␈↓will␈αbe;␈α
we␈αuse␈α
floating␈αpoint␈αand␈α
memory␈αmanagement,␈α
but␈αit␈αis␈α
not␈αclear␈α
that␈αthis␈α
is␈αaltogether
␈↓ ↓H␈↓necessary.



␈↓ ↓H␈↓␈↓β1.3.2 SOFTWARE␈↓

␈↓ ↓H␈↓See Figure 1.1 for a picture of the system.

␈↓ ↓H␈↓The␈α
SUPERVISOR␈α
is␈α
the␈α
top␈α
level␈α
of␈α
'AL.␈α
 It␈α
runs␈α
on␈α
the␈α
timesharing␈α
computer␈α
and␈α
provides␈α
an
␈↓ ↓H␈↓interface␈αbetween␈αthe␈αuser␈αand␈αthe␈αother␈αparts␈αof␈αthe␈αsystem:␈α1)␈αlistening␈αto␈αthe␈αuser's␈αconsole␈αand
␈↓ ↓H␈↓interpreting␈α⊂input␈α⊂in␈α⊂a␈α⊂simple␈α⊂command␈α⊃language;␈α⊂2)␈α⊂controlling␈α⊂the␈α⊂compiler,␈α⊂starting␈α⊃it␈α⊂and
␈↓ ↓H␈↓Page 8␈α?␈α?␈α?␈α?␈α?␈α%GENERAL SYSTEM OUTLINE␈↓ ∂1.3.2



␈↓ ↓H␈↓relaying␈αits␈αerror␈αmessages␈αback␈αto␈αthe␈αuser;␈α
3)␈αsignalling␈αthe␈αloader␈αwhen␈αit␈αis␈αnecessary␈α
to␈αplace
␈↓ ↓H␈↓compiled␈α∩code␈α∪into␈α∩the␈α∪mini;␈α∩4)␈α∪handling␈α∩the␈α∪runtime␈α∩interface␈α∪to␈α∩the␈α∪mini.␈α∩Each␈α∪of␈α∩these
␈↓ ↓H␈↓subsidiary modules is discussed below.

␈↓ ↓H␈↓The␈α∩USER␈α⊃sits␈α∩at␈α⊃a␈α∩console␈α⊃and␈α∩makes␈α⊃requests␈α∩of␈α⊃'AL.␈α∩ These␈α⊃fall␈α∩into␈α∩several␈α⊃categories:
␈↓ ↓H␈↓compilation,␈αloading,␈αexecution␈αof␈αprograms,␈αdebugging␈αof␈αcode,␈αrequesting␈αof␈α
status␈αinformation,
␈↓ ↓H␈↓asking␈α⊂for␈α⊂immediate␈α⊂arm␈α⊂motion,␈α⊂saving␈α⊂and␈α⊂restoring␈α⊂the␈α⊂state␈α⊂of␈α⊂the␈α⊂world␈α⊂at␈α⊂safe␈α⊂points,
␈↓ ↓H␈↓requesting␈αexplanation␈αof␈αcertain␈αcompiler␈αdecisions.␈αThere␈αare␈αtwo␈αdifferent␈αconsoles␈αat␈α
which␈αa
␈↓ ↓H␈↓user␈α
can␈α
sit:␈α∞one␈α
is␈α
connected␈α∞to␈α
the␈α
timesharing␈α∞computer,␈α
through␈α
which␈α∞she␈α
can␈α
speak␈α∞to␈α
the
␈↓ ↓H␈↓supervisor␈α
and␈α
all␈α
the␈α
parts␈α
of␈α
'AL␈α
residing␈α
on␈α
the␈α
timesharing␈α
computer;␈α
the␈α
other␈α
is␈α
connected␈α
to
␈↓ ↓H␈↓the mini, and through it the user can investigate the runtime system and cause modifications.

␈↓ ↓H␈↓The␈α
COMPILER␈αreads␈α
'AL␈α
programs␈αfrom␈α
files␈α(or,␈α
optionally,␈α
directly␈αfrom␈α
the␈α
user's␈αconsole)
␈↓ ↓H␈↓and␈α∩produces␈α⊃load␈α∩modules.␈α∩ The␈α⊃compiler␈α∩is␈α⊃divided␈α∩into␈α∩three␈α⊃phases:␈α∩The␈α∩PARSER,␈α⊃the
␈↓ ↓H␈↓EXPANDER,␈α
and␈αthe␈α
TRAJECTORY␈αCALCULATOR.␈α
The␈αcompiler␈α
is␈αdiscussed␈α
in␈α
detail␈αin
␈↓ ↓H␈↓the next section and is pictured in Figure 1.2.

␈↓ ↓H␈↓The␈αLOADER␈αtakes␈αthe␈αload␈αmodules␈αprepared␈αby␈αthe␈αcompiler␈αand␈αenters␈αthem␈αinto␈αthe␈αmini's
␈↓ ↓H␈↓runtime␈αsystem.␈α Address␈αrelocation␈αand␈αlinking␈αare␈αdone␈αat␈αthis␈αtime.␈αThe␈αloader␈αalso␈αsets␈αup␈αthe
␈↓ ↓H␈↓data␈αarea␈αin␈αthe␈αruntime␈αinterface␈αin␈αthe␈αtimesharing␈αcomputer;␈αthis␈αdata␈αincludes␈αoutput␈αstrings,
␈↓ ↓H␈↓procedure␈α
linkages,␈α
and␈α
information␈α
necessary␈α
for␈α
diagnostic␈α
purposes␈α
during␈α
runtime.␈α
 Loading␈α
is
␈↓ ↓H␈↓often␈α⊂done␈α⊂in␈α⊂a␈α⊂partially␈α⊂incremental␈α⊂fashion,␈α⊂installing␈α⊂new␈α⊂code␈α⊂following␈α⊂previously␈α∂loaded
␈↓ ↓H␈↓code.

␈↓ ↓H␈↓The␈α∩RUNTIME␈α∩INTERFACE,␈α∩which␈α∩resides␈α∩in␈α∩the␈α∩timesharing␈α∩computer,␈α∩is␈α∪charged␈α∩with
␈↓ ↓H␈↓initiating␈αthe␈αmini␈αprogram,␈αfielding␈αprocedure␈αcalls␈αfrom␈αthe␈αrunning␈αprogram␈αto␈αprocedures␈αon
␈↓ ↓H␈↓the␈α∞timesharing␈α∞machine,␈α∞returning␈α
values␈α∞from␈α∞these␈α∞procedures,␈α
and␈α∞fetching␈α∞values␈α∞from␈α
the
␈↓ ↓H␈↓mini␈α⊂for␈α⊂debugging␈α⊂purposes.␈α⊂ The␈α⊂interface␈α⊂has␈α⊂the␈α⊂power␈α⊂to␈α⊂interrupt␈α⊂the␈α⊂execution␈α⊃of␈α⊂the
␈↓ ↓H␈↓program␈α
and␈αto␈α
modify␈α
the␈αstatus␈α
of␈αthe␈α
runtime␈α
system,␈αfor␈α
example,␈αby␈α
patching␈α
in␈αadditional
␈↓ ↓H␈↓program,␈αor␈αmodifying␈αthe␈αvalues␈αof␈αsome␈αvariables.␈α This␈αallows␈αthe␈αuser␈αto␈αcontrol␈αthe␈αprogram
␈↓ ↓H␈↓through the timesharing computer.

␈↓ ↓H␈↓The␈αRUNTIME␈αSYSTEM␈αis␈αthe␈αset␈αof␈αprograms␈αwhich␈αreside␈αin␈αthe␈αmini.␈α This␈αsystem␈α
includes
␈↓ ↓H␈↓kernel␈α
programs␈α
for␈α
time-slice␈α
cpu␈α
sharing␈α
and␈α
process␈α
control␈α
and␈α
a␈α
set␈α
of␈α
dynamically␈α
created
␈↓ ↓H␈↓processes.␈α These␈αare␈αof␈αthree␈αbasic␈αtypes:␈αa)␈αAn␈αINTERPRETER␈αexamines␈αthe␈αcode␈αprepared␈α
by
␈↓ ↓H␈↓the␈α
compiler␈αand␈α
executes␈α
the␈αnumeric␈α
computations␈α
requested.␈α When␈α
a␈α
move␈αis␈α
to␈α
be␈αstarted,␈α
the
␈↓ ↓H␈↓interpreter␈α⊂creates␈α⊃a␈α⊂servo␈α⊂for␈α⊃each␈α⊂joint␈α⊃and␈α⊂waits␈α⊂until␈α⊃all␈α⊂these␈α⊂servos␈α⊃are␈α⊂finished.␈α⊃ b)␈α⊂A
␈↓ ↓H␈↓SERVO␈α∂handles␈α∂the␈α⊂motion␈α∂of␈α∂one␈α∂moving␈α⊂joint.␈α∂c)␈α∂A␈α⊂CONDITION-MONITOR␈α∂repeatedly
␈↓ ↓H␈↓examines␈α
certain␈α
conditions␈α
(whatever␈αthe␈α
programmer␈α
has␈α
specified).␈α If␈α
it␈α
should␈α
discover␈αthat
␈↓ ↓H␈↓its␈α
condition␈α
has␈α
occurred,␈α
it␈α
creates␈αan␈α
interpreter␈α
to␈α
take␈α
appropriate␈α
action.␈α
 The␈αruntime␈α
system
␈↓ ↓H␈↓also includes routines for communication with the runtime interface in the timesharing computer.
␈↓ ↓H␈↓1.3.2␈α?␈α?␈α?␈α?␈α?␈α=GENERAL SYSTEM OUTLINE␈↓ 
pPage 9


















































␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈αβFigure  1.1
␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α(Overall system
␈↓ ↓H␈↓Page 10␈α?␈α?␈α?␈α?␈α?␈α%GENERAL SYSTEM OUTLINE␈↓ ∂1.3.2


















































␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈αβFigure  1.2
␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α∀The 'AL compiler
␈↓ ↓H␈↓1.3.2␈α?␈α?␈α?␈α?␈α?␈α=GENERAL SYSTEM OUTLINE␈↓ 
aPage 11



␈↓ ↓H␈↓␈↓∧1.4 THE 'AL COMPILER␈↓

␈↓ ↓H␈↓The␈α
'AL␈α
compiler␈α
is␈α
built␈α
of␈α
three␈α
parts:␈α
the␈α
parser,␈α
the␈α
expander,␈α
and␈α
the␈α
trajectory␈αcalculator.
␈↓ ↓H␈↓These are depicted in Figure 21.2



␈↓ ↓H␈↓␈↓β1.4.1 PARSER␈↓

␈↓ ↓H␈↓The␈α
PARSER␈α
reads␈α
source␈α∞code␈α
from␈α
either␈α
the␈α∞console␈α
or␈α
a␈α
file.␈α∞ Its␈α
purpose␈α
is␈α
to␈α∞form␈α
parse
␈↓ ↓H␈↓trees␈α∞and␈α∂do␈α∞some␈α∞simple␈α∂manipulations,␈α∞such␈α∞as␈α∂assigning␈α∞line␈α∞numbers,␈α∂causing␈α∞listings␈α∂to␈α∞be
␈↓ ↓H␈↓directed␈α⊃to␈α⊃the␈α⊃appropriate␈α⊃file␈α⊃(if␈α∩desired),␈α⊃expanding␈α⊃text␈α⊃macros,␈α⊃and␈α⊃keeping␈α∩a␈α⊃primitive
␈↓ ↓H␈↓symbol␈αtable.␈α
 If␈αa␈α
syntax␈αerror␈α
is␈αdiscovered,␈αit␈α
informs␈αthe␈α
supervisor,␈αwhich␈α
will␈αgive␈α
the␈αuser
␈↓ ↓H␈↓several␈α∂options,␈α∂including␈α∂aborting␈α∂the␈α⊂compilation,␈α∂making␈α∂local␈α∂modifications␈α∂on␈α∂the␈α⊂spot,␈α∂or
␈↓ ↓H␈↓switching temporarily to a text editor.



␈↓ ↓H␈↓␈↓β1.4.2 EXPANDER ␈↓

␈↓ ↓H␈↓The␈α∩EXPANDER␈α∪shares␈α∩with␈α∪the␈α∩trajectory␈α∪calculator␈α∩the␈α∪responsibility␈α∩for␈α∪turning␈α∩parser
␈↓ ↓H␈↓output␈αinto␈αcode␈αinterpretable␈αby␈αthe␈αruntime␈αsystem.␈α Its␈αmain␈αfunctions␈αare␈αto␈αmaintain␈αa␈αmodel
␈↓ ↓H␈↓of␈α∞the␈α∞expected␈α∞runtime␈α∞state␈α∞at␈α∞each␈α∞point␈α∂in␈α∞the␈α∞program␈α∞and␈α∞to␈α∞use␈α∞this␈α∞model␈α∞to␈α∂resolve␈α∞a
␈↓ ↓H␈↓number␈α∃of␈α∃compile-time␈α∃decisions.␈α⊗ The␈α∃information␈α∃kept␈α∃includes␈α∃planning␈α⊗values,␈α∃object
␈↓ ↓H␈↓descriptions,␈α∞relations␈α∞between␈α∞objects,␈α∞endpoint␈α∞constraints␈α∞on␈α∞particular␈α∞trajectories,␈α∞and␈α∞much
␈↓ ↓H␈↓more.␈α∞ Simple␈α∞uses␈α∞of␈α
this␈α∞information␈α∞include␈α∞providing␈α
the␈α∞trajectory␈α∞calculator␈α∞with␈α
essential
␈↓ ↓H␈↓data␈α⊂and␈α⊂resolving␈α⊂conditional␈α⊂compilation␈α∂requests.␈α⊂ Beyond␈α⊂this,␈α⊂the␈α⊂expander␈α⊂has␈α∂principal
␈↓ ↓H␈↓responsibility␈α∂for␈α∂filling␈α∞in␈α∂the␈α∂details␈α∂required␈α∞to␈α∂turn␈α∂calls␈α∞on␈α∂various␈α∂high␈α∂and␈α∞intermediate
␈↓ ↓H␈↓level␈α∞primitives␈α∞into␈α∞runnable␈α∞manipulation␈α∞programs.␈α∞ It␈α∞therefore␈α∞contains␈α∞a␈α∞number␈α∂of␈α∞quite
␈↓ ↓H␈↓specialized␈α∂routines␈α∂with␈α∂considerable␈α∂knowledge␈α∂about␈α∂the␈α∂domain␈α∂of␈α∂mechanical␈α∂assembly,␈α∂as
␈↓ ↓H␈↓well as a number of more general mechanisms for coordinating the specialists.

␈↓ ↓H␈↓The␈α
expander␈α
supplies␈α
to␈α
the␈αtrajectory␈α
calculator␈α
a␈α
structure␈α
which␈αis␈α
very␈α
similar␈α
to␈α
the␈αparse
␈↓ ↓H␈↓trees it accepts as input.  However, no choices are left; all values have been explicitly specified.



␈↓ ↓H␈↓␈↓β1.4.3 TRAJECTORY CALCULATOR␈↓

␈↓ ↓H␈↓The␈α∩TRAJECTORY␈α∩CALCULATOR␈α∩takes␈α∪the␈α∩expanded␈α∩code␈α∩and␈α∩computes␈α∪the␈α∩required
␈↓ ↓H␈↓trajectories␈αfor␈αthe␈αarms.␈α Tables␈αof␈αinterpretable␈αcode␈αare␈αgenerated␈αfor␈αhandling␈αarithmetic␈αand
␈↓ ↓H␈↓assignment␈α⊃operations,␈α⊃condition␈α⊃monitoring,␈α⊃and␈α⊃affixment␈α⊃structure␈α⊃building␈α∩operations␈α⊃(the
␈↓ ↓H␈↓runtime␈α∞system␈α∂keeps␈α∞track␈α∂of␈α∞physical␈α∂attachment␈α∞of␈α∂objects).␈α∞ For␈α∂motions,␈α∞detailed␈α∂tables␈α∞are
␈↓ ↓H␈↓emitted␈αspecifying␈α
how␈αeach␈αjoint␈α
of␈αeach␈α
arm␈αis␈αto␈α
behave,␈αwhat␈αcomputations␈α
to␈αmake␈α
at␈αrun-
␈↓ ↓H␈↓time␈αfor␈αthe␈αmodification␈αof␈αthese␈αtrajectories␈αto␈αbring␈αthem␈αinto␈αcorrespondence␈αwith␈αthe␈αcurrent
␈↓ ↓H␈↓state␈α
of␈α
the␈α
world␈α
(for␈α
it␈α
happens␈α
often␈α
that␈α
objects␈α
are␈α
not␈α
exactly␈α
where␈α
they␈α
were␈α
planned␈αto
␈↓ ↓H␈↓be), and what conditions to monitor during the motion.
␈↓ ↓H␈↓Page 12␈α?␈α?␈α?␈α?␈α?␈α?␈α-THE 'AL COMPILER␈↓ ∂1.4.3



␈↓ ↓H␈↓The␈αtrajectory␈αcalculator␈α
also␈αis␈αused␈α
to␈αprovide␈αinformation␈α
to␈αthe␈αexpander.␈α
 For␈αinstance,␈αit␈α
can
␈↓ ↓H␈↓predict␈α
the␈α
runtime␈α
effects␈αof␈α
a␈α
given␈α
modification␈α
of␈αa␈α
planned␈α
trajectory.␈α
 This␈α
information␈αis
␈↓ ↓H␈↓useful␈αto␈αthe␈αexpander␈αfor␈αdeciding␈αhow␈αmany␈αdifferent␈αtrajectories␈αmust␈αbe␈αplanned␈αfor␈αa␈αgiven
␈↓ ↓H␈↓motion request, for estimating the feasibility of a given motion, and for other similar purposes.

␈↓ ↓H␈↓There␈αare␈αseveral␈αerrors␈αwhich␈αthe␈αtrajectory␈αcalculator␈αcan␈αdetect.␈α A␈αrequest␈αmight␈αtake␈αthe␈αarm
␈↓ ↓H␈↓outside␈α∂its␈α∂range,␈α∞or␈α∂force␈α∂a␈α∂joint␈α∞to␈α∂exceed␈α∂its␈α∞velocity␈α∂limits.␈α∂ It␈α∂may␈α∞discover␈α∂that␈α∂there␈α∂is␈α∞a
␈↓ ↓H␈↓possibility␈α
of␈αcollision␈α
between␈αthe␈α
two␈α
arms,␈αor␈α
between␈αthe␈α
arm␈α
and␈αsome␈α
object␈αon␈α
the␈αtable.␈α
 In
␈↓ ↓H␈↓order␈α
to␈αcarry␈α
out␈α
these␈αtests,␈α
it␈αmay␈α
request␈α
assurance␈αfrom␈α
the␈αuser␈α
that␈α
some␈αobject␈α
lies␈αwithin␈α
a
␈↓ ↓H␈↓certain␈α∞region,␈α∂or␈α∞it␈α∂may␈α∞give␈α∂the␈α∞user␈α∂a␈α∞warning.␈α∞ The␈α∂world␈α∞model␈α∂is␈α∞used␈α∂for␈α∞much␈α∂of␈α∞this
␈↓ ↓H␈↓calculation.␈α
 At␈α
its␈αdiscretion,␈α
the␈α
trajectory␈αcalculator␈α
may␈α
make␈αsome␈α
critical␈α
motions␈α
very␈αslow,
␈↓ ↓H␈↓so that an impending collision will be detected before it happens.

␈↓ ↓H␈↓The output of the trajectory calculator is stored in binary files, for loading into the PDP11.





␈↓ ↓H␈↓␈↓∧1.5 USER FEATURES␈↓

␈↓ ↓H␈↓'AL␈α
is␈α
designed␈αfor␈α
users␈α
of␈α
several␈αvarieties;␈α
not␈α
all␈α
of␈αthe␈α
system␈α
is␈α
of␈αuse␈α
to␈α
each␈α
of␈αthem.␈α
 Some
␈↓ ↓H␈↓users␈α⊃wish␈α⊃to␈α⊃make␈α⊃manipulation␈α⊃programs␈α⊂with␈α⊃primitive␈α⊃motions.␈α⊃ Others␈α⊃are␈α⊃interested␈α⊂in
␈↓ ↓H␈↓combining␈α⊃several␈α⊃often-used␈α⊃library␈α⊃routines␈α⊃in␈α⊂order␈α⊃to␈α⊃make␈α⊃an␈α⊃assembly␈α⊃program.␈α⊂ More
␈↓ ↓H␈↓sophisticated␈α
users␈αmay␈α
wish␈αto␈α
create␈α
library␈αroutines␈α
and␈αinteract␈α
with␈αthe␈α
intracacies␈α
of␈αworld
␈↓ ↓H␈↓modelling.␈α∞ While␈α∞a␈α∞task␈α∞is␈α∞being␈α∞executed␈α∞by␈α
the␈α∞manipulator,␈α∞a␈α∞user␈α∞may␈α∞wish␈α∞to␈α∞monitor␈α
its
␈↓ ↓H␈↓progress,␈α
investigate␈α
the␈α
internal␈α
state␈αof␈α
the␈α
program,␈α
or␈α
insert␈α
patches␈αin␈α
the␈α
code␈α
to␈α
fix␈αerrors␈α
or
␈↓ ↓H␈↓attempt␈α
some␈α
modification.␈α
 Thus,␈αthe␈α
user␈α
may␈α
have␈α
various␈αdegrees␈α
of␈α
understanding␈α
of␈αthe␈α
'AL
␈↓ ↓H␈↓system, various modes of interaction, and various reasons for using 'AL.

␈↓ ↓H␈↓The␈α∂bulk␈α∞of␈α∂user␈α∞interaction␈α∂with␈α∞'AL␈α∂is␈α∂during␈α∞the␈α∂stage␈α∞of␈α∂planning␈α∞a␈α∂set␈α∂of␈α∞manipulations.
␈↓ ↓H␈↓This␈α∞planning␈α∞has␈α∞several␈α∞phases:␈α∞initial␈α
preparation␈α∞of␈α∞the␈α∞program,␈α∞removing␈α∞syntactic␈α
errors
␈↓ ↓H␈↓from␈α
the␈α
source␈αcode,␈α
trying␈α
the␈α
program␈αout,␈α
and␈α
fixing␈α
discovered␈αbugs␈α
until␈α
the␈αprogram␈α
works
␈↓ ↓H␈↓properly.␈α
 The␈α
final␈α
stage␈α
is␈α∞the␈α
production␈α
run␈α
of␈α
the␈α∞program,␈α
which␈α
can␈α
occur␈α
in␈α∞a␈α
basically
␈↓ ↓H␈↓unsupervised␈α∞mode.␈α∞During␈α
execution,␈α∞however,␈α∞it␈α
is␈α∞still␈α∞possible␈α
to␈α∞interrupt␈α∞the␈α∞machine␈α
and
␈↓ ↓H␈↓find␈α⊂out␈α⊂exactly␈α⊂where␈α⊃it␈α⊂is␈α⊂in␈α⊂the␈α⊃plan␈α⊂and␈α⊂debug␈α⊂it␈α⊂further.␈α⊃This␈α⊂is␈α⊂useful␈α⊂for␈α⊃patching␈α⊂a
␈↓ ↓H␈↓program which over the course of a long execution begins to "drift" from reality.

␈↓ ↓H␈↓Thus, the user features can be divided roughly into these parts:



␈↓ ↓H␈↓␈↓β1.5.1 PROGRAM FORMULATION␈↓

␈↓ ↓H␈↓The␈α'AL␈αsource␈αlanguage␈αis␈αintended␈αto␈αbe␈αa␈αclear␈αand␈αcomplete␈αsystem␈αin␈αwhich␈αto␈αexpress␈αthose
␈↓ ↓H␈↓manipulations␈αnecessary␈αfor␈αthe␈αcorrect␈αexecution␈αof␈αan␈αassembly␈αtask.␈α Writing␈αin␈α'AL␈αshould␈αbe
␈↓ ↓H␈↓relatively easy; its inherent structure will be great aid in preparing correct programs.
␈↓ ↓H␈↓1.5.1␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α≥USER FEATURES␈↓ 
aPage 13



␈↓ ↓H␈↓Another␈α
way␈α
in␈α
which␈α
'AL␈αcan␈α
assist␈α
the␈α
programmer␈α
is␈α
that␈αit␈α
can␈α
read␈α
the␈α
current␈α
location␈αof␈α
an
␈↓ ↓H␈↓arm␈α
and␈α
make␈α
it␈α
available␈α
to␈α
the␈α
programmer.␈α
 This␈α
makes␈α
some␈α
teaching␈α
by␈α∞showing␈α
possible.
␈↓ ↓H␈↓One␈α
way␈αto␈α
put␈αtogether␈α
a␈α
simple␈αprogram␈α
is␈αmerely␈α
to␈α
move␈αthe␈α
arm␈αmanually␈α
to␈α
the␈αdifferent
␈↓ ↓H␈↓locations␈αdesired,␈αhave␈αthe␈αsystem␈αremember␈αthose␈αlocations,␈αand␈αthen␈αtype␈αin␈αappropriate␈αmotion
␈↓ ↓H␈↓commands␈α
using␈α
these␈α
points.␈αIn␈α
general,␈α
a␈α
simple␈α
"go␈αthere"␈α
approach␈α
fails,␈α
because␈α
it␈αprovides
␈↓ ↓H␈↓no␈αway␈αto␈α
indicate␈αhow␈αfast␈αthe␈α
arm␈αis␈αto␈αmove,␈α
what␈αforces␈αto␈αapply,␈α
what␈αerrors␈αto␈α
ignore␈αand
␈↓ ↓H␈↓what␈αconditions␈αto␈αmonitor.␈α However,␈α'AL␈αwill␈αallow␈αone␈αto␈αbuild␈αcomplete␈αmotion␈αspecifications
␈↓ ↓H␈↓about␈α∂a␈α∂skeleton␈α⊂of␈α∂intermediate␈α∂points,␈α∂using␈α⊂textual␈α∂input␈α∂to␈α∂make␈α⊂up␈α∂for␈α∂the␈α⊂limitations␈α∂of
␈↓ ↓H␈↓purely tactile input.



␈↓ ↓H␈↓␈↓β1.5.2 PROGRAM COMPILATION␈↓

␈↓ ↓H␈↓The␈α∂supervisor␈α∂is␈α∂the␈α∂key␈α∂to␈α∂this␈α∂and␈α∂the␈α∂following␈α∂features;␈α∂it␈α∂allows␈α∂the␈α∂user␈α∂to␈α⊂oversee␈α∂the
␈↓ ↓H␈↓progress␈αof␈αthe␈αprogram␈αand␈αfix␈αerrors␈αas␈αthey␈αarise.␈α There␈αis␈αa␈αsimple␈α␈↓βsupervisor␈αlanguage␈↓␈αused
␈↓ ↓H␈↓to␈α⊂communicate␈α⊂with␈α⊂the␈α∂'AL␈α⊂system.␈α⊂ Some␈α⊂of␈α⊂its␈α∂commands␈α⊂are␈α⊂demonstrated␈α⊂in␈α⊂the␈α∂sample
␈↓ ↓H␈↓dialog␈α∂given␈α∂in␈α∞Appendix␈α∂I.␈α∂ One␈α∂of␈α∞the␈α∂commands␈α∂causes␈α∂compilation␈α∞to␈α∂begin;␈α∂the␈α∂parser␈α∞is
␈↓ ↓H␈↓directed␈αto␈αread␈αsome␈αfile.␈α An␈αoption␈αis␈αto␈αhave␈αconsole␈αinput␈αitself␈αused␈αto␈αenter␈αthe␈αsource␈αcode;
␈↓ ↓H␈↓this␈αis␈αespecially␈αuseful␈αin␈αcausing␈αthe␈αarm␈αto␈αdo␈αsomething␈αimmediately.␈αWhen␈αthe␈αparser␈αfinds␈αa
␈↓ ↓H␈↓syntax␈αerror,␈α
it␈αwill␈α
give␈αan␈α
error␈αmessage,␈α
and␈αseveral␈α
options␈αwill␈α
in␈αgeneral␈α
be␈αavailable.␈α
 These
␈↓ ↓H␈↓include␈α∞aborting␈α∞the␈α∂compilation,␈α∞skipping␈α∞to␈α∂the␈α∞end␈α∞of␈α∞the␈α∂current␈α∞statement,␈α∞editing␈α∂the␈α∞line
␈↓ ↓H␈↓with␈α∂the␈α∂system␈α∂line␈α∂editor␈α∞(after␈α∂which␈α∂the␈α∂entire␈α∂statement␈α∞will␈α∂be␈α∂reparsed,␈α∂if␈α∂possible),␈α∞and
␈↓ ↓H␈↓temporarily␈αswitching␈αto␈αa␈αtext␈αeditor␈αto␈αfix␈αthe␈αproblem␈α(after␈αwhich␈αthe␈αentire␈αprogram␈αmust␈αbe
␈↓ ↓H␈↓reparsed).

␈↓ ↓H␈↓The␈α∩compiler␈α∩detects␈α∩semantic␈α∩errors␈α∩such␈α∩as␈α⊃generating␈α∩a␈α∩move␈α∩to␈α∩a␈α∩point␈α∩with␈α⊃undefined
␈↓ ↓H␈↓planning␈α⊂value,␈α⊂not␈α⊂supplying␈α⊂enough␈α⊂information␈α∂to␈α⊂a␈α⊂high-level␈α⊂primitive,␈α⊂or␈α⊂attempting␈α∂to
␈↓ ↓H␈↓move␈α
the␈αsame␈α
arm␈α
simultaneously␈αin␈α
two␈α
blocks␈αof␈α
code.␈α
 In␈αthose␈α
cases␈α
where␈αthe␈α
problem␈αis␈α
one
␈↓ ↓H␈↓of␈α∞insufficient␈α∞information,␈α∞the␈α∞expander␈α∞will␈α
prompt␈α∞for␈α∞more,␈α∞and,␈α∞if␈α∞possible,␈α∞continue.␈α
 The
␈↓ ↓H␈↓user␈α⊂may␈α⊃decide␈α⊂not␈α⊃to␈α⊂supply␈α⊂that␈α⊃information,␈α⊂and␈α⊃in␈α⊂that␈α⊂case,␈α⊃the␈α⊂offending␈α⊃statement␈α⊂is
␈↓ ↓H␈↓flushed.␈α
 Some␈α∞errors␈α
are␈α
so␈α∞drastic␈α
that␈α
they␈α∞require␈α
complete␈α
recompilation;␈α∞the␈α
user␈α∞is␈α
always
␈↓ ↓H␈↓given the option of switching to a text editor for major modifications.

␈↓ ↓H␈↓The␈αtrajectory␈αcalculator␈αcan␈αdiscover␈αa␈αlimited␈αnumber␈αof␈αerrors.␈α These␈αmostly␈αinvolve␈αmotions
␈↓ ↓H␈↓beyond␈αthe␈αcapability␈αof␈αthe␈αmanipulators␈αinvolved.␈α Options␈αto␈αthe␈αuser␈αinclude␈αmaking␈αthe␈αbest
␈↓ ↓H␈↓possible␈α⊃legal␈α⊃trajectory,␈α⊃causing␈α⊃the␈α⊃trajectory␈α⊃to␈α⊃be␈α⊃slowed␈α⊃down,␈α⊃and␈α⊃inserting␈α⊃a␈α⊃trajectory
␈↓ ↓H␈↓which, when executed, does nothing.



␈↓ ↓H␈↓␈↓β1.5.3 PROGRAM EXECUTION␈↓

␈↓ ↓H␈↓After␈αa␈αprogram␈αhas␈αbeen␈α
compiled,␈αit␈αresides␈αon␈αdisk␈αas␈α
a␈αload␈αmodule.␈α Any␈αnumber␈αof␈α
modules
␈↓ ↓H␈↓can␈αbe␈αloaded␈α
together;␈αthe␈αprincipal␈α
restriction␈αis␈αthat␈αeach␈α
of␈αthem␈αbe␈α
a␈α"top␈αlevel"␈αprogram.␈α
 As
␈↓ ↓H␈↓mentioned␈α⊂earlier,␈α∂the␈α⊂loader␈α∂will␈α⊂resolve␈α∂calls␈α⊂between␈α∂the␈α⊂large␈α∂(planning)␈α⊂computer␈α⊂and␈α∂the
␈↓ ↓H␈↓small␈α_(execution)␈α_computer␈α_for␈α_those␈α_functions␈α_which␈α_the␈α_user␈α_has␈α_decided␈α_require␈α↔the
␈↓ ↓H␈↓computational ability found only on the large computer.
␈↓ ↓H␈↓Page 14␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α¬USER FEATURES␈↓ ∂1.5.3



␈↓ ↓H␈↓Execution␈αis␈αinitiated␈αby␈αa␈αsupervisor␈αcommand␈α
issued␈αby␈αthe␈αuser.␈α While␈αthe␈αmini␈α
is␈αexecuting
␈↓ ↓H␈↓the␈α
program,␈α
the␈α
user␈α
can␈α
cause␈α
an␈α
interruption␈α
and␈α
examine␈α
values␈α
within␈α
the␈α
runtime␈αsystem,
␈↓ ↓H␈↓and␈αmodify␈αthem␈αif␈αhe␈αwishes.␈α It␈αis␈αalso␈αpossible␈αto␈αexamine␈αthe␈αcode␈αgenerated␈αby␈αthe␈αcompiler
␈↓ ↓H␈↓and␈α∂modify␈α∂it,␈α∂but␈α⊂this␈α∂is␈α∂most␈α∂likely␈α∂only␈α⊂of␈α∂interest␈α∂to␈α∂system␈α∂programmers.␈α⊂ Sizable␈α∂patches
␈↓ ↓H␈↓require␈α∞recompilation.␈α∞The␈α∞programmer␈α∞(or,␈α∞at␈α∞this␈α∞stage,␈α∞an␈α∞operator)␈α∞can␈α∂continually␈α∞examine
␈↓ ↓H␈↓the␈α⊂status␈α⊂of␈α⊂the␈α⊂runtime␈α∂system␈α⊂by␈α⊂means␈α⊂of␈α⊂the␈α∂mini's␈α⊂console.␈α⊂ Values␈α⊂of␈α⊂variables␈α⊂can␈α∂be
␈↓ ↓H␈↓examined␈α⊃and␈α⊂changed,␈α⊃and␈α⊃individual␈α⊂processes␈α⊃can␈α⊃be␈α⊂interrupted␈α⊃without␈α⊃interfering␈α⊂with
␈↓ ↓H␈↓other concurrent processes.

␈↓ ↓H␈↓Sometimes␈αhardware␈α
difficulties␈αwill␈αcause␈α
abrupt␈αtermination␈α
of␈αthe␈αprogram;␈α
these␈αoften␈αare␈α
due
␈↓ ↓H␈↓to␈αruntime␈αtrajectory␈αmodifications␈αoverstraining␈αthe␈αhardware.␈α After␈αissuing␈αan␈αerror␈αmessage␈αto
␈↓ ↓H␈↓the␈α⊂user,␈α∂the␈α⊂system␈α∂behaves␈α⊂just␈α∂as␈α⊂it␈α⊂would␈α∂should␈α⊂it␈α∂have␈α⊂been␈α∂interrupted␈α⊂manually.␈α⊂It␈α∂is
␈↓ ↓H␈↓popβible,␈αduring␈αone␈α
of␈αthese␈α"breaks",␈αto␈α
request␈αthat␈αthe␈αentire␈α
world␈αbe␈αsaved.␈α This␈α
causes␈αall
␈↓ ↓H␈↓runtime␈α
values␈αto␈α
be␈α
written␈αout␈α
into␈αa␈α
safe␈α
place,␈αalong␈α
with␈α
the␈αcurrent␈α
attachment␈αstructure␈α
and
␈↓ ↓H␈↓the␈αcurrent␈αprogram␈αcounters.␈α
 This␈αfeature␈αallows␈αthe␈αdebugging␈α
of␈αthe␈αtask␈αto␈α
stop␈αtemporarily
␈↓ ↓H␈↓and␈α
to␈αbe␈α
resumed␈α
later.␈α More␈α
importantly,␈αit␈α
is␈α
possible␈αto␈α
create␈αa␈α
"safe␈α
point"␈αin␈α
the␈α
code,␈αso
␈↓ ↓H␈↓that␈α∂if␈α∂an␈α∂error␈α∞should␈α∂occur␈α∂later,␈α∂it␈α∂is␈α∞possible␈α∂to␈α∂back␈α∂up␈α∂the␈α∞program␈α∂to␈α∂a␈α∂point␈α∂at␈α∞which
␈↓ ↓H␈↓everything was still working.

␈↓ ↓H␈↓Programs␈αwhich␈αhave␈αbeen␈α
completely␈αdebugged␈αcan␈αbe␈α"unloaded",␈α
that␈αis,␈αsaved␈αin␈α
a␈αcompiled
␈↓ ↓H␈↓form for execution any time in the future.
␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α
␈↓ 
aPage 15



␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α0␈↓∧CHAPTER 2␈↓
␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α␈↓¬THE BASIC SOURCE LANGUAGE␈↓

␈↓ ↓H␈↓'AL␈α
has␈α
several␈αlevels␈α
of␈α
complexity.␈α
 We␈αwill␈α
start␈α
by␈α
discussing␈αthe␈α
basic␈α
source␈α
language;␈αthis
␈↓ ↓H␈↓covers␈α∀enough␈α∀to␈α∀write␈α∀substantial␈α∀manipulator␈α∀programs,␈α∀but␈α∀has␈α∀none␈α∀of␈α∀the␈α∀high␈α∀level
␈↓ ↓H␈↓capabilities mentioned in the section on goals and philosophy.





␈↓ ↓H␈↓␈↓∧2.1 DATA STRUCTURES␈↓



␈↓ ↓H␈↓␈↓β2.1.1 DATA TYPES␈↓

␈↓ ↓H␈↓In␈α∞this␈α∞section␈α∞we␈α∞present␈α∞the␈α∞data␈α∞types␈α∞available␈α∞in␈α∞'AL.␈α∞ Roughly␈α∞speaking,␈α∞a␈α∞␈↓βdata␈α∞type␈↓␈α∂is␈α∞a
␈↓ ↓H␈↓kind␈αof␈αnumeric␈αobject.␈α For␈αexample,␈αFORTRAN␈αhas␈αthe␈αdata␈αtypes␈αINTEGER␈αand␈αREAL.␈α A
␈↓ ↓H␈↓␈↓βvariable␈↓␈α∞is␈α
an␈α∞identifier␈α
of␈α∞some␈α
type␈α∞which␈α
can␈α∞take␈α
on␈α∞␈↓βvalues␈↓.␈α
 In␈α∞'AL,␈α
each␈α∞variable␈α∞must␈α
be
␈↓ ↓H␈↓␈↓βdeclared␈↓,␈α∂that␈α⊂is,␈α∂one␈α∂must␈α⊂state␈α∂what␈α∂its␈α⊂type␈α∂is,␈α∂somewhere␈α⊂in␈α∂the␈α∂program␈α⊂before␈α∂it␈α⊂is␈α∂used.
␈↓ ↓H␈↓There␈α
are␈αseveral␈α
reasons␈αfor␈α
this:␈αIt␈α
allows␈αthe␈α
compiler␈αto␈α
detect␈αspelling␈α
errors,␈αand␈α
it␈αallows␈α
the
␈↓ ↓H␈↓same␈α∂name␈α∂to␈α⊂be␈α∂used␈α∂in␈α⊂different␈α∂blocks␈α∂without␈α∂conflict.␈α⊂ 'AL␈α∂uses␈α∂ALGOL␈α⊂block␈α∂structure,
␈↓ ↓H␈↓which␈α
means␈α
that␈α
all␈α
variables␈α
declared␈α
between␈α
a␈α
particular␈α
BEGIN␈α
and␈α
END␈α
are␈α
accessible␈α
only
␈↓ ↓H␈↓to␈αcode␈αwhich␈αappears␈αbetween␈αthe␈αsame␈αBEGIN-END␈αpair.␈αThe␈αexact␈αdetails␈αof␈αblock␈αstructure
␈↓ ↓H␈↓are discussed in the section on control structures.



␈↓ ↓H␈↓␈↓β2.1.2 ALGEBRAIC DATA TYPES: SCALARS␈↓

␈↓ ↓H␈↓Algebraic␈αdata␈α
types␈αare␈αthe␈α
most␈αfamiliar.␈α They␈α
represent␈αmeasurements␈αin␈α
the␈αreal␈α
world.␈α An
␈↓ ↓H␈↓algebraic␈α∞variable␈α∞can␈α∞assume␈α∞a␈α∞value␈α∞by␈α
means␈α∞of␈α∞the␈α∞␈↓βassignment␈α∞statement␈↓,␈α∞which␈α∞consists␈α
of
␈↓ ↓H␈↓the␈α∞variable␈α∞name,␈α∞a␈α∞left␈α
arrow␈α∞("←"),␈α∞and␈α∞an␈α∞expression␈α
which␈α∞has␈α∞the␈α∞correct␈α∞type.␈α∞ When␈α
an
␈↓ ↓H␈↓assignment␈α∂statement␈α∞is␈α∂executed,␈α∂the␈α∞expression␈α∂on␈α∂the␈α∞right␈α∂hand␈α∂side␈α∞is␈α∂evaluated,␈α∂and␈α∞that
␈↓ ↓H␈↓value replaces the old value of the variable on the left hand side.

␈↓ ↓H␈↓The␈α∩most␈α∩elementary␈α∩data␈α∩type␈α∩is␈α⊃␈↓βscalar␈↓,␈α∩which␈α∩is␈α∩internally␈α∩represented␈α∩as␈α∩a␈α⊃floating-point
␈↓ ↓H␈↓number.␈α Scalars␈α
are␈αused␈α
for␈αdimensionless␈αquantities,␈α
like␈αthe␈α
number␈αof␈α
times␈αsome␈αoperation␈α
is
␈↓ ↓H␈↓to␈α
be␈α
repeated,␈α
or␈α
to␈α
implement␈α
a␈αsignal␈α
which␈α
becomes␈α
positive␈α
when␈α
some␈α
critical␈α
operation␈αis
␈↓ ↓H␈↓finished.␈α∀ The␈α∀arithmetic␈α∀operations␈α∀available␈α∀on␈α∀scalar␈α∀variables␈α∀are␈α∀addition,␈α∀subtraction,
␈↓ ↓H␈↓multiplication,␈α⊃and␈α⊃division;␈α⊃the␈α⊃arithmetic␈α∩operators␈α⊃which␈α⊃perform␈α⊃these␈α⊃operations␈α∩are␈α⊃the
␈↓ ↓H␈↓standard:␈α
+,␈α
-,␈α*,␈α
/.␈α
 As␈αis␈α
usual␈α
in␈α
algebraic␈αlanguages,␈α
the␈α
first␈αtwo␈α
have␈α
lower␈α
precedence␈αthan
␈↓ ↓H␈↓the others.

␈↓ ↓H␈↓Scalar␈α∞constants␈α∞are␈α∂written␈α∞as␈α∞(base␈α∞ten)␈α∂numbers,␈α∞either␈α∞with␈α∞or␈α∂without␈α∞a␈α∞decimal␈α∂point␈α∞and
␈↓ ↓H␈↓fractional part.  Here are some examples of declarations and applications of scalar variables:
␈↓ ↓H␈↓Page 16␈α?␈α?␈α?␈α?␈α?␈α?␈α)DATA STRUCTURES␈↓ ∂2.1.2



␈↓ ↓H␈↓        SCALAR s1, s2;
␈↓ ↓H␈↓␈↓ βλ␈↓β{Our␈α∩examples␈α∪will␈α∩use␈α∩a␈α∪mnemonic␈α∩scheme␈α∩for␈α∪naming␈α∩variables␈α∩to␈α∪clarify␈α∩the
␈↓ ↓H␈↓β␈↓ βλtype␈α∃of␈α∃each␈α∃entity.␈α∃ Please␈α∃understand␈α∀that␈α∃identifiers␈α∃can␈α∃be␈α∃any␈α∃string␈α∀of
␈↓ ↓H␈↓β␈↓ βλletters,␈α∃of␈α∃any␈α⊗length,␈α∃and␈α∃that␈α∃'AL␈α⊗does␈α∃not␈α∃distinguish␈α∃between␈α⊗upper␈α∃and
␈↓ ↓H␈↓β␈↓ βλlower case.  Curly brackets are used in 'AL to enclose comments.}
␈↓ ↓H␈↓        s1 ← 2;
␈↓ ↓H␈↓        s2 ← 3.74;
␈↓ ↓H␈↓        s1 ← s2 * (s1 - 3.2);


␈↓ ↓H␈↓It␈α
is␈α
often␈α
desirable␈α
to␈α
give␈α
some␈α
physical␈α
meaning␈α
to␈α
scalar␈α
variables.␈α
 'AL␈α
provides␈α
for␈αscalars
␈↓ ↓H␈↓with␈αthe␈αdimensions␈α␈↓βtime,␈αdistance,␈αangle,␈↓␈αand␈α␈↓βmass␈↓␈αin␈αaddition␈αto␈α"simple",␈αdimensionless␈αscalars.
␈↓ ↓H␈↓Time␈α∞constants␈α∞are␈α∞just␈α∂like␈α∞simple␈α∞scalar␈α∞constants,␈α∞except␈α∂they␈α∞are␈α∞multiplied␈α∞by␈α∂the␈α∞reserved
␈↓ ↓H␈↓word␈α∞␈↓βsec␈↓␈α
(for␈α∞"seconds").␈α∞ The␈α
other␈α∞reserved␈α∞words␈α
related␈α∞to␈α∞these␈α
dimensioned␈α∞scalars␈α∞are␈α
␈↓βcm␈↓
␈↓ ↓H␈↓(centimeters), ␈↓βdeg␈↓ (degrees) and ␈↓βgm␈↓ (grams).

␈↓ ↓H␈↓Dimensioned␈αscalars␈αare␈αused␈α
exactly␈αin␈αthe␈αsame␈α
way␈αas␈αsimple␈αscalars;␈α
the␈αonly␈αdifference␈αis␈α
that
␈↓ ↓H␈↓'AL␈α⊃will␈α⊃check␈α⊃that␈α⊃addition␈α⊃and␈α⊃subtraction␈α⊃are␈α⊃only␈α⊃performed␈α⊃on␈α⊃compatible␈α⊃values.␈α⊂ 'AL
␈↓ ↓H␈↓performs␈α∪dimension␈α∪checking␈α∪for␈α∪each␈α∩arithmetic␈α∪operation␈α∪and␈α∪each␈α∪assignment.␈α∩ Addition,
␈↓ ↓H␈↓subtraction,␈αand␈αassignment␈αrequire␈αexact␈αdimension␈αmatch,␈αbut␈αif␈αmatch␈αfails␈αand␈αone␈αof␈αthe␈αtwo
␈↓ ↓H␈↓arguments␈α∞is␈α∞simple␈α∞(no␈α∞dimension),␈α∞it␈α∞will␈α∞be␈α∞converted.␈α∞ Thus␈α∞it␈α∞is␈α∞always␈α∞legal␈α∞to␈α∂use␈α∞simple
␈↓ ↓H␈↓scalars␈α∃where␈α∃dimensioned␈α∃ones␈α∃are␈α∃expected.␈α∃ Multiplication␈α∃and␈α∃division␈α∃do␈α⊗not␈α∃require
␈↓ ↓H␈↓dimension␈α∪match;␈α∪they␈α∪produce␈α∪a␈α∪result␈α∀of␈α∪a␈α∪dimension␈α∪usually␈α∪different␈α∪from␈α∪that␈α∀of␈α∪the
␈↓ ↓H␈↓arguments;␈α⊗this␈α⊗new␈α⊗dimension␈α⊗is␈α⊗then␈α⊗propagated␈α⊗through␈α⊗the␈α⊗expression.␈α⊗ In␈α⊗this␈α∃way,
␈↓ ↓H␈↓intermediate␈α
results␈α
can␈αbe␈α
of␈α
dimensions␈α
not␈αdeclared.␈α
 This␈α
causes␈α
no␈αproblem␈α
unless␈α
one␈αtries␈α
to
␈↓ ↓H␈↓use such results in an assignment.

␈↓ ↓H␈↓Here are some examples of dimensioned scalars:

␈↓ ↓H␈↓        TIME SCALAR tm1, tm2;
␈↓ ↓H␈↓        MASS SCALAR ms1;
␈↓ ↓H␈↓        ANGLE SCALAR theta, phi;

␈↓ ↓H␈↓        tm1 ← 3 * SEC;
␈↓ ↓H␈↓        ms1 ← ms1 + 2.2 * GM;
␈↓ ↓H␈↓        ms1 ← ms1 + 2.2;
␈↓ ↓H␈↓␈↓ βλ␈↓β{The constant 2.2 will be automatically converted to grams.}
␈↓ ↓H␈↓        theta ← 90 * DEG;
␈↓ ↓H␈↓        tm1 ← tm2 * 5.5;
␈↓ ↓H␈↓        phi ← theta * 4 * DEG;
␈↓ ↓H␈↓␈↓ βλ␈↓β{This is a mistake; the right side has dimension ␈↓angle*angle␈↓β}


␈↓ ↓H␈↓If␈α
the␈α
user␈α
feels␈α
more␈α
comfortable␈α
with␈α
inches␈αor␈α
pounds,␈α
it␈α
is␈α
quite␈α
easy␈α
to␈α
write␈α
macros␈αwhich
␈↓ ↓H␈↓will make such usage possible.  This is best demonstrated by example:
␈↓ ↓H␈↓2.1.2␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈ααDATA STRUCTURES␈↓ 
aPage 17



␈↓ ↓H␈↓        DEFINE INCHES = "(2.54 * CM)";
␈↓ ↓H␈↓        DEFINE FEET = "(12 * INCHES)";
␈↓ ↓H␈↓        DEFINE LB = "(GM * 1000 / 2.2)";

␈↓ ↓H␈↓        ms1 ← 2.2*LB;  {= 1000*GM}
␈↓ ↓H␈↓        ds1 ← 3*FEET;  {= 3*12*2.54*CM}


␈↓ ↓H␈↓The␈αuser␈αmay␈αwish␈αto␈αcreate␈αnew␈αdimensioned␈α
scalars,␈αsuch␈αas␈αforces␈αor␈αvelocities.␈α This␈αis␈α
readily
␈↓ ↓H␈↓done by means of the ␈↓βdimension␈↓ statement and a few macros.  For instance,

␈↓ ↓H␈↓        DIMENSION FORCE = DISTANCE*MASS/(TIME*TIME);
␈↓ ↓H␈↓        DEFINE DYNES = "(GM*CM/(SEC*SEC))";
␈↓ ↓H␈↓        DIMENSION VELOCITY = DISTANCE/TIME;
␈↓ ↓H␈↓        DEFINE CPS = "(CM/SEC)";

␈↓ ↓H␈↓        FORCE SCALAR fo1;
␈↓ ↓H␈↓        VELOCITY SCALAR ve1;
␈↓ ↓H␈↓        ve1 ← 2.3*CPS;
␈↓ ↓H␈↓        fo1 ← ve1 * 3 * GM / (8.4 * SEC);


␈↓ ↓H␈↓Please␈αnote␈αthat␈αthe␈αDIMENSION␈αstatement␈αand␈αmacros␈αfollow␈αblock␈αstructure;␈αit␈αis␈αa␈αgood␈αidea
␈↓ ↓H␈↓to put them in the outermost block.



␈↓ ↓H␈↓␈↓β2.1.3 VECTORS␈↓

␈↓ ↓H␈↓Scalars␈αare␈αinsufficient␈αto␈αdescribe␈αall␈αmeasurements␈αof␈αinterest␈αto␈αthe␈αuser␈αof␈α'AL.␈α We␈αturn␈αnow
␈↓ ↓H␈↓to␈αother␈αalgebraic␈αdata␈αtypes.␈α They␈αare␈αsyntactically␈αmuch␈αlike␈αscalars:␈αthey␈αare␈αdeclared␈αand␈αcan
␈↓ ↓H␈↓enter into arithmetic expressions and assignments.

␈↓ ↓H␈↓The␈αworld␈αin␈αwhich␈α'AL␈αresides␈αhas␈αthree␈αdimensions.␈α We␈αimpose␈αa␈αEuclidean␈αstructure␈αon␈αthat
␈↓ ↓H␈↓space␈α∪by␈α∪setting␈α∪up␈α∩three␈α∪cardinal,␈α∪orthogonal␈α∪axes,␈α∪which␈α∩meet␈α∪at␈α∪the␈α∪origin.␈α∪ The␈α∩actual
␈↓ ↓H␈↓alignment␈αof␈αthese␈α␈↓βstation␈↓␈αaxes␈αwill,␈αin␈αgeneral,␈αdepend␈αon␈αthe␈αparticular␈αwork␈αstation␈αinvolved;␈αit
␈↓ ↓H␈↓is expected, however, that the positive Z axis will point upwards (this is not at all crucial).

␈↓ ↓H␈↓The␈α
first␈α∞data␈α
type␈α∞we␈α
will␈α
discuss␈α∞is␈α
the␈α∞␈↓βvector␈↓.␈α
 It␈α
represents␈α∞either␈α
a␈α∞translation␈α
or␈α∞a␈α
location.
␈↓ ↓H␈↓The␈αlatter␈αmeaning␈αis␈αthe␈αresult␈αof␈αtranslating␈αthe␈αnull␈αvector,␈αthat␈αis,␈αthe␈αorigin␈αof␈αthe␈αcoordinate
␈↓ ↓H␈↓system.  As is the case with scalars, vectors may be dimensioned.

␈↓ ↓H␈↓Vectors␈α∂can␈α∂be␈α∞constructed␈α∂from␈α∂three␈α∞scalar␈α∂expressions␈α∂by␈α∞means␈α∂of␈α∂the␈α∂function␈α∞VECTOR.
␈↓ ↓H␈↓The␈αscalar␈αexpressions␈αmust␈αall␈αbe␈αof␈αthe␈αsame␈αdimension,␈αand␈αthe␈αresulting␈αvector␈αhas␈αthat␈αsame
␈↓ ↓H␈↓dimension.

␈↓ ↓H␈↓Addition␈α
and␈α∞subtraction␈α
are␈α∞defined␈α
on␈α∞vectors␈α
of␈α
the␈α∞same␈α
dimension.␈α∞ One␈α
other␈α∞function␈α
is
␈↓ ↓H␈↓available: the dot product.  For example, if the two vectors are:
␈↓ ↓H␈↓Page 18␈α?␈α?␈α?␈α?␈α?␈α?␈α)DATA STRUCTURES␈↓ ∂2.1.3



␈↓ ↓H␈↓        v1=VECTOR(x1,y1,z1) and v2=VECTOR(x2,y2,z2),

␈↓ ↓H␈↓then we have

␈↓ ↓H␈↓        s * v1 = VECTOR(s*x1, s*y1, s*z1)
␈↓ ↓H␈↓        v1 + v2 = VECTOR(x1+x2, y1+y2, z1+z2)
␈↓ ↓H␈↓        v1 - v2 = VECTOR(x1-x2, y1-y2, z1-z2)
␈↓ ↓H␈↓        v1 . v2 = x1*x2 + y1*y2 + z1*z2    .


␈↓ ↓H␈↓Thus,␈αaddition␈α
and␈αsubtraction␈αproduce␈α
vectors␈αin␈αthe␈α
familiar␈αway;␈α
the␈αdot␈αproduct␈α
is␈αthe␈αsum␈α
of
␈↓ ↓H␈↓the␈α
products␈α
of␈αthe␈α
three␈α
components;␈αits␈α
dimension␈α
is␈αthe␈α
product␈α
of␈αthe␈α
dimensions␈α
of␈α
the␈αtwo
␈↓ ↓H␈↓arguments.

␈↓ ↓H␈↓It␈α
is␈α∞possible␈α
to␈α∞"stretch"␈α
or␈α∞"shrink"␈α
vectors␈α∞by␈α
multiplying␈α∞and␈α
dividing␈α∞them␈α
by␈α∞scalars.␈α
 The
␈↓ ↓H␈↓dimension␈α∂of␈α∂the␈α∂resulting␈α∂vector␈α∂is␈α∂the␈α∂product␈α∂or␈α∂the␈α∂quotient␈α∂of␈α∂the␈α∂dimensions␈α∂of␈α⊂the␈α∂two
␈↓ ↓H␈↓arguments.␈αThe␈αmagnitude␈α
of␈αa␈αvector␈αis␈α
calculated␈αby␈αthe␈αfunction␈α
ABS,␈αwhich␈αreturns␈α
a␈αscalar
␈↓ ↓H␈↓of appropriate dimension.

␈↓ ↓H␈↓There are several predeclared vectors in 'AL:

␈↓ ↓H␈↓        VECTOR X, Y, Z, NILVEC;
␈↓ ↓H␈↓␈↓ βλ␈↓β{These are predeclared and have values as follows}
␈↓ ↓H␈↓        X ← VECTOR(1,0,0);
␈↓ ↓H␈↓        Y ← VECTOR(0,1,0);
␈↓ ↓H␈↓        Z ← VECTOR(0,0,1);
␈↓ ↓H␈↓        NILVEC ← VECTOR(0,0,0);

␈↓ ↓H␈↓The␈αcomponents␈αof␈α
a␈αvector␈αcan␈α
be␈αeasily␈αextracted␈α
as␈αthe␈αdot␈α
product␈αof␈αthe␈α
vector␈αwith␈αX,␈αY,␈α
or
␈↓ ↓H␈↓Z.  Here are examples of other vectors:

␈↓ ↓H␈↓        VECTOR v1;
␈↓ ↓H␈↓        DISTANCE VECTOR dv1, dv2;
␈↓ ↓H␈↓        SCALAR s1;
␈↓ ↓H␈↓        DISTANCE SCALAR ds1, ds2;

␈↓ ↓H␈↓        ds1 ← 4 * CM;
␈↓ ↓H␈↓        s1 ← -2;
␈↓ ↓H␈↓        dv1 ← VECTOR(s1, 2.3, ds1);
␈↓ ↓H␈↓␈↓ βλ␈↓β{This is a distance vector; the simple scalars get converted.}
␈↓ ↓H␈↓        ds2 ← dv1 . Y;  {␈↓βSo ds2 gets 2.3*CM␈↓}
␈↓ ↓H␈↓        v1 ← dv1 / ds2;  {␈↓βSo v1 ← VECTOR(-2/2.3, 1, 4/2.3)␈↓.}
␈↓ ↓H␈↓        dv2 ← ds2 * v1;  {␈↓βSo v2 ← dv1␈↓}
␈↓ ↓H␈↓        s1 ← ABS(v1);
␈↓ ↓H␈↓2.1.4␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈ααDATA STRUCTURES␈↓ 
aPage 19



␈↓ ↓H␈↓␈↓β2.1.4 ROTATIONS␈↓

␈↓ ↓H␈↓The␈α␈↓βrot␈↓,␈αour␈αnext␈αdata␈αtype,␈αrepresents␈αeither␈αa␈αrotation␈αor␈αan␈αorientation.␈α The␈αlatter␈αis␈αthe␈αresult
␈↓ ↓H␈↓of␈α∩applying␈α∩the␈α∩rotation␈α∩to␈α∩the␈α∩station␈α∩coordinate␈α∩system.␈α∩ Rots␈α∩are␈α∩internally␈α∩stored␈α∩as␈α⊃3x3
␈↓ ↓H␈↓matrices,␈α∞which␈α∞operate␈α∞on␈α∞column␈α∞vectors␈α∞in␈α
the␈α∞usual␈α∞way.␈α∞ Thus␈α∞rots␈α∞can␈α∞operate␈α∞on␈α
vectors
␈↓ ↓H␈↓and␈αmove␈αthem␈αaround␈αthe␈αorigin␈α(without␈αchanging␈αtheir␈αlength);␈αthey␈αcan␈αalso␈αoperate␈αon␈αother
␈↓ ↓H␈↓rots␈α
(by␈αmatrix␈α
multiplication).␈α
 To␈αrotate␈α
a␈α
vector␈α(about␈α
the␈α
station␈αorigin),␈α
multiply␈α
the␈αvector
␈↓ ↓H␈↓(on␈α
the␈α
right)␈α
by␈α∞the␈α
rot␈α
(on␈α
the␈α∞left).␈α
 To␈α
compose␈α
rots,␈α
multiply␈α∞them␈α
together;␈α
the␈α
one␈α∞on␈α
the
␈↓ ↓H␈↓right will be applied first.

␈↓ ↓H␈↓A␈α
rotation␈α
can␈α
be␈α
constructed␈α
with␈α
the␈α
function␈α
ROT,␈α
which␈α
takes␈α
two␈α
arguments:␈α
a␈αsimple␈α
vector,
␈↓ ↓H␈↓which␈αis␈αto␈αbe␈αthe␈αaxis␈αof␈αrotation,␈αand␈α
an␈αangle,␈αwhich␈αis␈αthe␈αamount␈αto␈αrotate.␈α The␈αdirection␈α
of
␈↓ ↓H␈↓rotation␈αfollows␈αthe␈αright-hand␈αrule;␈αa␈αrotation␈αof␈α90␈αdegrees␈αabout␈αthe␈αX␈αaxis␈αmoves␈αthe␈αY␈αaxis
␈↓ ↓H␈↓into␈αthe␈αZ␈αaxis.␈α This␈αturns␈αout␈αto␈αbe␈αa␈αgeneral␈αrepresentation␈αfar␈αeasier␈αto␈αwrite␈αand␈αunderstand
␈↓ ↓H␈↓than raw matrices.  We hope the following examples will serve to clarify the proper use of rots:

␈↓ ↓H␈↓        ROT r1, r2, r3;
␈↓ ↓H␈↓        ANGLE SCALAR alpha, beta, gamma;
␈↓ ↓H␈↓        r1 ← ROT(X, 90*DEG);
␈↓ ↓H␈↓        v1 ← r1 * Z;
␈↓ ↓H␈↓␈↓ βλ␈↓β{V1 gets Z rotated 90 degrees about X, so V1 ← VECTOR(0,-1,0).}
␈↓ ↓H␈↓        r2 ← ROT(Y, 45*DEG);
␈↓ ↓H␈↓        r3 ← r2 * r1;
␈↓ ↓H␈↓␈↓ βλ␈↓β{Thus,␈α∪r3␈α∪means:␈α∪rotate␈α∀first␈α∪90␈α∪degrees␈α∪about␈α∪the␈α∀X␈α∪axis,␈α∪then␈α∪45␈α∀about␈α∪the
␈↓ ↓H␈↓β␈↓ βλoriginal Y axis.}

␈↓ ↓H␈↓        r1 ← ROT(X,alpha);
␈↓ ↓H␈↓        r2 ← ROT(r1*Y,beta);
␈↓ ↓H␈↓        r3 ← ROT(r2*Z,gamma);
␈↓ ↓H␈↓        r4 ← r3 * r2 * r1;
␈↓ ↓H␈↓␈↓ βλ␈↓β{r4␈α∩is␈α∩then␈α∩a␈α∩rotation␈α∩with␈α∩this␈α⊃meaning:␈α∩Rotate␈α∩by␈α∩alpha␈α∩degrees␈α∩about␈α∩the␈α⊃X
␈↓ ↓H␈↓β␈↓ βλaxis,␈α∩then␈α∪by␈α∩beta␈α∪degrees␈α∩about␈α∪the␈α∩new␈α∩Y␈α∪axis,␈α∩then␈α∪by␈α∩gamma␈α∪degrees␈α∩about
␈↓ ↓H␈↓β␈↓ βλthe doubly new Z axis.}

␈↓ ↓H␈↓The null rot, which has no effect, is called NILROT.



␈↓ ↓H␈↓␈↓β2.1.5 FRAMES␈↓

␈↓ ↓H␈↓The␈α
next␈α
data␈α
type␈α
is␈α
the␈α
␈↓βframe␈↓,␈α
used␈α
to␈α
represent␈α
a␈α
coordinate␈α
system.␈α
 It␈α
has␈α
two␈αcomponents:␈α
the
␈↓ ↓H␈↓location␈α⊂of␈α⊂the␈α⊂origin␈α⊂(a␈α⊂distance␈α⊂vector)␈α⊂and␈α∂the␈α⊂orientation␈α⊂of␈α⊂the␈α⊂axes␈α⊂(a␈α⊂rot).␈α⊂ Frames␈α∂are
␈↓ ↓H␈↓typically␈αused␈αto␈αdescribe␈αobjects;␈αone␈αcan␈αspecify␈αlocations␈αof␈αfeatures␈αon␈αan␈αobject␈αby␈αtranslating
␈↓ ↓H␈↓them from the object's origin.

␈↓ ↓H␈↓There␈α∂are␈α∂several␈α∂predeclared␈α∂frames␈α∂in␈α⊂'AL.␈α∂ ␈↓βStation␈↓␈α∂is␈α∂the␈α∂frame␈α∂which␈α∂represents␈α⊂the␈α∂work
␈↓ ↓H␈↓station's␈αframe␈αof␈αreference.␈α Each␈αhand␈αavailable␈αto␈αthe␈αsystem␈αalso␈αhas␈αa␈αframe␈αvariable,␈αwhose
␈↓ ↓H␈↓value␈α∞(continually␈α∞updated)␈α∞is␈α∞the␈α∞position␈α∞of␈α
that␈α∞hand.␈α∞ Currently,␈α∞there␈α∞are␈α∞two␈α∞such␈α
frames:
␈↓ ↓H␈↓␈↓βyellow␈↓ and ␈↓βblue␈↓.  Each arm has a rest, or park position, known as ␈↓βypark␈↓ and ␈↓βbpark␈↓.
␈↓ ↓H␈↓Page 20␈α?␈α?␈α?␈α?␈α?␈α?␈α)DATA STRUCTURES␈↓ ∂2.1.5



␈↓ ↓H␈↓A frame may be constructed by a call on the function FRAME:

␈↓ ↓H␈↓        FRAME f1;
␈↓ ↓H␈↓        DISTANCE VECTOR dv1;
␈↓ ↓H␈↓        ROT r1;
␈↓ ↓H␈↓        :
␈↓ ↓H␈↓        f1 ← FRAME(r1,dv1);

␈↓ ↓H␈↓The␈αtwo␈αarguments␈α
are␈αa␈αa␈α
rot␈α(for␈αthe␈αorientation)␈α
and␈αa␈αdistance␈α
vector␈α(for␈αthe␈α
position).␈α To
␈↓ ↓H␈↓extract␈α
the␈α
rot␈αor␈α
the␈α
vector␈α
from␈αa␈α
frame,␈α
use␈α
the␈αfunctions␈α
ORIENT␈α
and␈α
LOC,␈αrespectively.␈α
 To
␈↓ ↓H␈↓find␈α
where␈α
a␈α
vector␈α
goes␈α
if␈α
its␈α
base␈α
is␈α
moved␈α
from␈α
the␈α
station␈α
to␈α
the␈α
coordinate␈α
system␈α∞of␈α
some
␈↓ ↓H␈↓frame,␈α∞"multiply"␈α∞the␈α∞frame␈α∞(on␈α∞the␈α∞left)␈α∞by␈α∞the␈α∞vector␈α∞(on␈α∞the␈α∞right).␈α∞ To␈α∞translate␈α∞a␈α∂frame␈α∞by
␈↓ ↓H␈↓some distance, simply add a distance vector to it.

␈↓ ↓H␈↓Often␈α∂one␈α∂wants␈α∂to␈α∂construct␈α∂a␈α∂vector␈α∂which␈α∂is␈α∂oriented␈α∂like␈α∂some␈α∂vector␈α∂(for␈α∂example,␈α∂the␈α∂X
␈↓ ↓H␈↓vector)␈α
in␈α
some␈α
frame,␈α
say␈α
F1.␈α
 The␈α
␈↓βwith␈α
respect␈α
to␈↓␈α
operator␈α
␈↓βWRT␈↓␈α
gives␈α
exactly␈α
that;␈α
one␈αwrites
␈↓ ↓H␈↓(X WRT F1).  Examples of this and other constructs pertaining to frames follow:

␈↓ ↓H␈↓        FRAME f1, f2;
␈↓ ↓H␈↓        f1 ← FRAME(ROT(Z,90*DEG),2*X);
␈↓ ↓H␈↓␈↓ βλ␈↓β{f1␈α⊂sits␈α⊂2␈α⊃centimeters␈α⊂from␈α⊂the␈α⊃station,␈α⊂in␈α⊂the␈α⊃X␈α⊂direction.␈α⊂ Its␈α⊃coordinate␈α⊂system
␈↓ ↓H␈↓β␈↓ βλhas X where the station's Y points.}
␈↓ ↓H␈↓        v1 ← X WRT f1;  {␈↓βThis evaluates to VECTOR(0,1,0).␈↓}
␈↓ ↓H␈↓        f2 ← f1 + v1;  {␈↓βJust like f1, but with origin at (2,1,0).␈↓}
␈↓ ↓H␈↓        v1 ← f1 * Y;  {␈↓βThis evaluates to VECTOR(1,0,0)␈↓}
␈↓ ↓H␈↓        v2 ← v3 WRT f2;
␈↓ ↓H␈↓␈↓ βλ␈↓β{This is equivalent to (f2*v3) - LOC(f2), and also to ORIENT(f2)*v3.}




␈↓ ↓H␈↓␈↓β2.1.6 PLANES␈↓

␈↓ ↓H␈↓Next␈αwe␈αhave␈αthe␈α␈↓βplane␈↓,␈αused␈αto␈αseparate␈α
space␈αinto␈αregions␈αand␈αto␈αspecify␈αthe␈αlocus␈α
of␈αsearches.
␈↓ ↓H␈↓Planes␈αare␈αformed␈αby␈αuse␈αof␈αthe␈α
function␈αPLANE,␈αwhich␈αtakes␈αtwo␈αdistance␈αvectors␈αas␈α
arguments:
␈↓ ↓H␈↓The␈α
plane␈α
is␈α
to␈α
pass␈α
through␈α
the␈α
first␈αvector,␈α
and␈α
the␈α
outward-facing␈α
normal␈α
to␈α
the␈α
plane␈α
is␈αin
␈↓ ↓H␈↓the␈α⊂direction␈α⊂of␈α⊂the␈α⊂second␈α⊂vector.␈α⊂ Thus␈α∂PLANE(X,Y)␈α⊂is␈α⊂a␈α⊂plane␈α⊂parallel␈α⊂to␈α⊂the␈α⊂X-Z␈α∂plane,
␈↓ ↓H␈↓translated from it by one centimeter in the X direction.

␈↓ ↓H␈↓Planes␈α
are␈α
internally␈α
stored␈α
by␈α
four␈α
numbers:␈αthe␈α
first␈α
three␈α
are␈α
an␈α
outward-facing␈α
normal,␈αand
␈↓ ↓H␈↓the last is the opposite of the distance from the plane to the origin.

␈↓ ↓H␈↓Each␈α⊂plane␈α⊃divides␈α⊂space␈α⊃into␈α⊂three␈α⊂regions:␈α⊃inside,␈α⊂on,␈α⊃and␈α⊂outside␈α⊂the␈α⊃plane.␈α⊂ (The␈α⊃last␈α⊂set
␈↓ ↓H␈↓contains␈α∞all␈α
points␈α∞on␈α
the␈α∞same␈α
side␈α∞as␈α∞outward-facing␈α
normal.)␈α∞To␈α
find␈α∞out␈α
in␈α∞which␈α∞region␈α
a
␈↓ ↓H␈↓point␈α
(represented␈α
by␈α
a␈α
distance␈αvector)␈α
lies,␈α
extract␈α
the␈α
inner␈αproduct␈α
of␈α
the␈α
vector␈α
with␈αthe␈α
plane.
␈↓ ↓H␈↓Its␈αvalue␈α
is␈αa␈αdistance␈α
scalar␈αwhose␈αabsolute␈α
value␈αis␈αthe␈α
shortest␈αdistance␈αfrom␈α
the␈αvector␈α
to␈αthe
␈↓ ↓H␈↓plane,␈αand␈αwhose␈αsign␈αis␈αnegative␈αif␈αthe␈αvector␈αis␈αinside␈αthe␈αplane,␈α0␈αif␈αthe␈αvector␈αis␈αon␈αthe␈αplane,
␈↓ ↓H␈↓and␈αpositive␈αif␈αthe␈αvector␈α
is␈αoutside␈αthe␈αplane.␈α The␈αarithmetic␈α
operator␈αfor␈αthe␈αinner␈αproduct␈αis␈α
a
␈↓ ↓H␈↓2.1.6␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈ααDATA STRUCTURES␈↓ 
aPage 21



␈↓ ↓H␈↓dot;␈αthe␈αplane␈α
may␈αappear␈αon␈α
either␈αside␈αof␈α
the␈αdot.␈α If␈α
the␈αplane␈αP␈α
has␈αan␈αinternal␈α
representation
␈↓ ↓H␈↓consisting of four numbers A, B, C, and D, and V = VECTOR(X1,Y1,Z1), then we have:

␈↓ ↓H␈↓        P . V = A*X1 + B*X2 * C*X3 + D


␈↓ ↓H␈↓Other␈α∞operations␈α
available␈α∞on␈α∞planes␈α
are␈α∞translation␈α
(by␈α∞adding␈α∞a␈α
distance␈α∞vector)␈α∞and␈α
rotation
␈↓ ↓H␈↓(by␈α∞multiplying␈α∞by␈α∞a␈α∞rotation).␈α∞ To␈α∞get␈α∞the␈α∞outward-facing␈α∞normal␈α∞of␈α∞a␈α∞plane,␈α∞use␈α∂the␈α∞function
␈↓ ↓H␈↓NORMAL, which takes a plane argument and returns a distance vector.

␈↓ ↓H␈↓Examples:

␈↓ ↓H␈↓        PLANE p1, p2;
␈↓ ↓H␈↓        p1 ← PLANE(VECTOR(0,0,0),Z);
␈↓ ↓H␈↓␈↓ βλ␈↓β{This is the surface of the station}
␈↓ ↓H␈↓        v1 ← NORMAL(p1 + v2);
␈↓ ↓H␈↓␈↓ βλ␈↓β{No matter what v2 is, v1 will get Z}
␈↓ ↓H␈↓        ds1 ← p1 ␈↓∧.␈↓ VECTOR(2, -13.2, 32.3);
␈↓ ↓H␈↓␈↓ βλ␈↓β{ds1 gets 32.3*cm}




␈↓ ↓H␈↓␈↓β2.1.7 TRANSFORMS␈↓

␈↓ ↓H␈↓The␈αlast␈αof␈αthe␈αalgebraic␈αdata␈αtypes␈αis␈αthe␈α␈↓βtrans␈↓,␈αwhich␈αstands␈αfor␈α"transform".␈α It␈αis␈αan␈αoperator,
␈↓ ↓H␈↓that␈αis,␈αa␈αfunction,␈αwhich␈αcan␈αoperate␈αon␈αvectors,␈αframes,␈αand␈αplanes.␈α The␈αapplication␈αof␈αa␈αtrans
␈↓ ↓H␈↓to␈α
any␈α
of␈α∞these␈α
is␈α
written␈α∞as␈α
if␈α
it␈α∞were␈α
a␈α
multiplication,␈α∞with␈α
the␈α
trans␈α∞on␈α
the␈α
left.␈α∞ To␈α
compose
␈↓ ↓H␈↓several transes together, "multiply" them, with the one to be applied first on the right.

␈↓ ↓H␈↓The␈α∞trans␈α∞itself␈α∞is␈α∞defined␈α
as␈α∞a␈α∞function␈α∞which␈α∞can␈α∞take␈α
objects␈α∞in␈α∞one␈α∞frame␈α∞of␈α∞reference␈α
into
␈↓ ↓H␈↓another.  One can construct a trans by use of the function TRANS:

␈↓ ↓H␈↓        TRANS t1;
␈↓ ↓H␈↓        VECTOR v1;
␈↓ ↓H␈↓        ROT r1;
␈↓ ↓H␈↓        :
␈↓ ↓H␈↓        t1 ← TRANS(r1,v1);

␈↓ ↓H␈↓The␈α
two␈α
arguments␈α
are␈α
a␈αrotation␈α
the␈α
rotational␈α
part␈α
and␈αa␈α
vector␈α
(the␈α
translational␈α
part).␈α The
␈↓ ↓H␈↓application␈α
of␈αa␈α
trans␈αto␈α
a␈αvector,␈α
frame,␈αor␈α
plane␈αfirst␈α
rotates␈αthat␈α
object␈αaccording␈α
to␈αthe␈α
rotation
␈↓ ↓H␈↓part␈α
(rotating␈α
about␈α
the␈αstation␈α
origin),␈α
and␈α
then␈α
translates␈αthe␈α
result␈α
according␈α
to␈αthe␈α
translational
␈↓ ↓H␈↓part.

␈↓ ↓H␈↓Transes,␈αlike␈αvectors␈αand␈αscalars,␈α
carry␈αdimension.␈α The␈αrule␈αis␈αthat␈α
when␈αa␈αtrans␈αis␈αapplied␈α
to␈αa
␈↓ ↓H␈↓vector,␈α
they␈α
must␈αagree␈α
in␈α
dimension;␈αthe␈α
resulting␈α
vector␈αis␈α
of␈α
the␈αsame␈α
dimension.␈α
 When␈αa␈α
trans
␈↓ ↓H␈↓is␈αapplied␈αto␈αa␈αframe,␈αit␈αmust␈αbe␈αa␈αdistance␈αtrans.␈α When␈αa␈αframe␈αis␈αused␈αin␈αa␈αcontext␈αdemanding
␈↓ ↓H␈↓a␈α∞transformation,␈α∂it␈α∞will␈α∂be␈α∞understood␈α∂as␈α∞a␈α∂shorthand␈α∞for␈α∂the␈α∞distance␈α∂trans␈α∞leading␈α∂from␈α∞the
␈↓ ↓H␈↓station.  When transes are composed, they must agree in dimension.
␈↓ ↓H␈↓Page 22␈α?␈α?␈α?␈α?␈α?␈α?␈α)DATA STRUCTURES␈↓ ∂2.1.7



␈↓ ↓H␈↓There␈αis␈αanother␈αconvenient␈αway␈αto␈αspecify␈αa␈αtrans:␈αby␈αforming␈αit␈αfrom␈αtwo␈αframes.␈α The␈αtrans␈αis
␈↓ ↓H␈↓then␈α∂the␈α∂function␈α∞which␈α∂takes␈α∂the␈α∞origin␈α∂of␈α∂the␈α∂first␈α∞frame␈α∂across␈α∂to␈α∞the␈α∂origin␈α∂of␈α∂the␈α∞second,
␈↓ ↓H␈↓performing␈α∪a␈α∀rotation␈α∪first␈α∪to␈α∀get␈α∪the␈α∪axes␈α∀aligned.␈α∪ This␈α∪method␈α∀of␈α∪specifying␈α∪a␈α∀trans␈α∪is
␈↓ ↓H␈↓accomplished by use of the arithmetic operator "→".

␈↓ ↓H␈↓Examples:

␈↓ ↓H␈↓        TRANS t1, t2;
␈↓ ↓H␈↓        t1 ← f1 → f2; {␈↓βThus t1*f1 = f2␈↓}
␈↓ ↓H␈↓        v1 ← t1 * v2;
␈↓ ↓H␈↓        t2 ← t1 * t1;
␈↓ ↓H␈↓        v1 ← f1 * v2;  {␈↓βEquivalent to (STATION→f1)*v2␈↓}


␈↓ ↓H␈↓The null trans, equivalent to TRANS(NILROT,NILVEC) is called NILTRANS.



␈↓ ↓H␈↓␈↓β2.1.8 PLANNING VALUES␈↓

␈↓ ↓H␈↓'AL␈α∞works␈α
under␈α∞the␈α
fundamental␈α∞philosophy␈α
that␈α∞arm␈α
motions␈α∞should␈α
be␈α∞planned␈α∞in␈α
advance.
␈↓ ↓H␈↓Since␈αan␈αarm␈αtrajectory␈αcannot␈αbe␈αcalculated␈αreasonably␈αunless␈αthe␈αend-points␈α(and␈α
any␈αspecified
␈↓ ↓H␈↓intermediate␈α∂points)␈α∂are␈α∂known␈α∂fairly␈α∂accurately,␈α∂it␈α∂is␈α∂necessary␈α∂that␈α∂the␈α∂compiler␈α∂maintain␈α∂for
␈↓ ↓H␈↓each␈α∞variable␈α∞a␈α∂␈↓βplanning␈α∞value␈↓␈α∞which␈α∂may␈α∞be␈α∞used␈α∞in␈α∂the␈α∞case␈α∞that␈α∂the␈α∞variable␈α∞enters␈α∂into␈α∞a
␈↓ ↓H␈↓motion specification.  Planning values are discussed in more detail in Section 3.2.

␈↓ ↓H␈↓Essentially,␈α
the␈α
compiler␈α
attempts␈α
to␈α
assign␈α
to␈α
each␈α
variable␈α
a␈α
planning␈α
value␈α
for␈α
each␈α
statement␈α
in
␈↓ ↓H␈↓the␈αprogram.␈α Initially,␈αthe␈αplanning␈αvalue␈αof␈αeach␈αvariable␈αis␈α"undefined";␈αone␈αof␈αthe␈αways␈αthat␈αa
␈↓ ↓H␈↓planning␈αvalue␈αcan␈αbe␈αassumed␈αis␈α
through␈αan␈αassignment␈αstatement.␈α The␈αcompiler␈α
evaluates␈αthe
␈↓ ↓H␈↓planning␈αvalue␈αof␈αthe␈αright␈αhand␈αside,␈α
and␈αthis␈αbecomes␈αthe␈αnew␈αplanning␈αvalue␈αof␈α
the␈αvariable
␈↓ ↓H␈↓on␈α⊃the␈α⊃left.␈α⊂Propagating␈α⊃the␈α⊃planning␈α⊂value␈α⊃across␈α⊃loops␈α⊂is␈α⊃complicated;␈α⊃in␈α⊂the␈α⊃case␈α⊃that␈α⊂the
␈↓ ↓H␈↓variable␈α
can␈αtake␈α
multiple␈αvalues,␈α
the␈α
compiler␈αeither␈α
sets␈αthe␈α
planning␈α
value␈αto␈α
"undefined"␈αor,␈α
as
␈↓ ↓H␈↓'AL␈α∀becomes␈α∀more␈α∀advanced,␈α∀maintains␈α∀parallel␈α∀"worlds"␈α∀in␈α∀which␈α∀each␈α∀planning␈α∀value␈α∪is
␈↓ ↓H␈↓monovalued.

␈↓ ↓H␈↓Variables␈α∂can␈α∂attain␈α∂different␈α∂values␈α∂at␈α∂run-time␈α∂than␈α∂their␈α∂planning␈α∂values␈α∂when␈α∂some␈α∂real-
␈↓ ↓H␈↓world␈αmeasurement␈α
is␈αtaken␈αand␈α
the␈αresult␈αused␈α
in␈αan␈αarithmetic␈α
expression.␈α The␈α
most␈αcommon
␈↓ ↓H␈↓example␈α⊃of␈α⊃this␈α⊃is␈α⊃that␈α∩the␈α⊃frames␈α⊃␈↓βyellow␈↓␈α⊃and␈α⊃␈↓βblue␈↓␈α∩are␈α⊃always␈α⊃kept␈α⊃accurate␈α⊃at␈α∩run-time␈α⊃by
␈↓ ↓H␈↓feedback from the arm hardware, so their values will in general differ from those planned.



␈↓ ↓H␈↓␈↓β2.1.9 ARITHMETIC␈↓

␈↓ ↓H␈↓Here␈α
is␈α
a␈αsummary␈α
of␈α
the␈αarithmetic␈α
expressions␈α
available.␈α They␈α
are␈α
grouped␈αby␈α
the␈α
type␈αof␈α
their
␈↓ ↓H␈↓values.␈α
 These␈α
abbreviations␈α
are␈α
used:␈α
`s'␈α
=␈α
scalar,␈α
`v'␈α
=␈αvector,␈α
`r'␈α
=␈α
rot,␈α
`f'␈α
=␈α
frame,␈α
`p'␈α
=␈α
plane,␈α`t'␈α
=
␈↓ ↓H␈↓trans.  ␈↓ε
␈↓ ↓H␈↓2.1.9␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈ααDATA STRUCTURES␈↓ 
aPage 23




␈↓ ↓H␈↓εscalar expressions:
␈↓ ↓H␈↓εs + s           scalar addition (commutative)
␈↓ ↓H␈↓εs - s           scalar subtraction
␈↓ ↓H␈↓εs * s           scalar multiplication (commutative)
␈↓ ↓H␈↓εs / s           scalar division
␈↓ ↓H␈↓εv . v           dot product of two vectors (commutative)
␈↓ ↓H␈↓εp . v           signed distance from vector to plane (see discussion
␈↓ ↓H␈↓ε                        above on planes)
␈↓ ↓H␈↓εv . p           signed distance from vector to plane (see discussion
␈↓ ↓H␈↓ε                        above on planes)

␈↓ ↓H␈↓εvector expressions:
␈↓ ↓H␈↓εs * v           dilation of a vector
␈↓ ↓H␈↓εv / s           contraction of a vector
␈↓ ↓H␈↓εv + v           vector addition (translation of the first vector by 
␈↓ ↓H␈↓ε                        the second) (commutative)
␈↓ ↓H␈↓εv - v           vector subtraction
␈↓ ↓H␈↓εr * v           rotation of a vector
␈↓ ↓H␈↓εt * v           transformation of a vector
␈↓ ↓H␈↓εv WRT f         a vector of length ABS(v) rotated into f's system; like
␈↓ ↓H␈↓ε                        ORIENT(f)*v; that is, a vector in station
␈↓ ↓H␈↓ε                        coordinates which looks to the station as v
␈↓ ↓H␈↓ε                        does to f.
␈↓ ↓H␈↓εrot expressions:
␈↓ ↓H␈↓εr * r           composition of two rots (first to be applied is on the 
␈↓ ↓H␈↓ε                        right)

␈↓ ↓H␈↓εframe expressions:
␈↓ ↓H␈↓εf + v           translation of a frame
␈↓ ↓H␈↓εt * f           transformation of a frame

␈↓ ↓H␈↓εplane expressions:
␈↓ ↓H␈↓εp + v           translation of a plane by a vector
␈↓ ↓H␈↓εr * p           rotation of plane (about station origin)
␈↓ ↓H␈↓εt * p           transformation of a plane by a trans

␈↓ ↓H␈↓εtrans expressions:
␈↓ ↓H␈↓εf → f           transformation which leads from the first frame to
␈↓ ↓H␈↓ε                        the second
␈↓ ↓H␈↓εt * t           composing two transes.  The one on the right will 
␈↓ ↓H␈↓ε                        operate first.
␈↓ ↓H␈↓Page 24␈α?␈α?␈α?␈α?␈α?␈α?␈α)DATA STRUCTURES␈↓ ∂2.1.9




␈↓ ↓H␈↓ε␈↓PREDECLARED CONSTANTS AND VARIABLES:

␈↓ ↓H␈↓π is simple, has value = 3.14159...
␈↓ ↓H␈↓STATION is a frame which has standard station coordinates. (constant)
␈↓ ↓H␈↓BLUE is the location of the blue hand.
␈↓ ↓H␈↓YELLOW is the location of the yellow hand.
␈↓ ↓H␈↓BPARK is where the blue hand parks. (constant)
␈↓ ↓H␈↓YPARK is where the yellow hand parks. (constant)
␈↓ ↓H␈↓X is VECTOR(1,0,0).
␈↓ ↓H␈↓Y is VECTOR(0,1,0).
␈↓ ↓H␈↓Z is VECTOR(0,0,1).
␈↓ ↓H␈↓NILVEC is VECTOR(0,0,0).
␈↓ ↓H␈↓NILROT is ROT(X,0*DEG).
␈↓ ↓H␈↓NILTRANS is TRANS(NILROT,NILVEC).

␈↓ ↓H␈↓EXTRACTION FUNCTIONS:

␈↓ ↓H␈↓LOC(FRAME) is a vector whose value is the location of the frame.
␈↓ ↓H␈↓ORIENT(FRAME) is a rot whose value is the orientation of the frame.
␈↓ ↓H␈↓NORMAL(PLANE)   is the outward facing normal vector of a plane.




␈↓ ↓H␈↓ε␈↓β2.1.10 SOME EXAMPLES OF ARITHMETIC EXPRESSIONS␈↓ε

␈↓ ↓H␈↓In the following examples, assume these declarations:
␈↓ ↓H␈↓FRAME f1, f2, etc;
␈↓ ↓H␈↓VECTOR v1, v2, etc;
␈↓ ↓H␈↓SIMPLE s1, s2, etc;
␈↓ ↓H␈↓ROT r1, r2, etc;
␈↓ ↓H␈↓PLANE p1, p2, etc;

␈↓ ↓H␈↓f1'S unit Y vector, in station coordinates:
␈↓ ↓H␈↓        f1 * Y

␈↓ ↓H␈↓f1's Z vector as seen from f2:
␈↓ ↓H␈↓        (f2 → f1) * Z

␈↓ ↓H␈↓A vector pointing in same direction as f1's X coordinate:
␈↓ ↓H␈↓        X WRT f1

␈↓ ↓H␈↓v1 rotated 90 degrees about the station's Z axis:
␈↓ ↓H␈↓        ROT(Z,90*DEG)*v1

␈↓ ↓H␈↓f1's Y-Z plane:
␈↓ ↓H␈↓        PLANE(LOC(f1),X WRT f1)
␈↓ ↓H␈↓2.1.10␈α?␈α?␈α?␈α?␈α?␈α?␈α9DATA STRUCTURES␈↓ 
aPage 25



␈↓ ↓H␈↓A plane 3 centimeters above the station:
␈↓ ↓H␈↓        PLANE(VECTOR(0,0,3),Z);
␈↓ ↓H␈↓        PLANE(3*Z,Z);

␈↓ ↓H␈↓An identity with WRT:
␈↓ ↓H␈↓        v1 WRT f1 = ORIENT(f1)*v1 = (f1*v1) - LOC(f1)






␈↓ ↓H␈↓␈↓∧2.2 MOTIONS␈↓

␈↓ ↓H␈↓Motion statements are at the heart of 'AL; it is by them that all manipulatory work is done.



␈↓ ↓H␈↓␈↓β2.2.1 COMPILE-TIME AND RUNTIME CONSIDERATIONS␈↓

␈↓ ↓H␈↓All␈α
motion␈α
statements␈α
cause␈αthe␈α
compiler␈α
to␈α
make␈α
some␈αplans␈α
which␈α
will␈α
eventually␈α
be␈αexecuted.
␈↓ ↓H␈↓Those␈αmotions␈αwhich␈αdepend␈αon␈αthe␈αvalue␈αof␈αsome␈αframe␈αexpressions␈αfor␈αintermediate␈α
and␈αfinal
␈↓ ↓H␈↓position␈α
will␈α
be␈α
planned␈α
using␈α
the␈α
compile-time␈α
planning␈α
values␈α
for␈α
all␈α
relevant␈α
expressions.␈α
 This
␈↓ ↓H␈↓can␈α∂lead␈α∂to␈α∂inaccurate␈α∂plans,␈α∂since␈α∂at␈α∂runtime,␈α∂some␈α∂of␈α∂those␈α∂expressions␈α∂might␈α∂have␈α∂different
␈↓ ↓H␈↓values.␈α An␈αexample␈αis␈αan␈αexpression␈αinvolving␈α
the␈αlocation␈αof␈αthe␈αarm;␈αthe␈αvariables␈α
␈↓βyellow␈↓␈αand
␈↓ ↓H␈↓␈↓βblue␈↓␈α
are␈α
always␈α
kept␈α
accurate␈α
at␈α
runtime␈α∞by␈α
reading␈α
the␈α
arm␈α
locations.␈α
 Since␈α
every␈α∞arm␈α
motion
␈↓ ↓H␈↓must␈α
begin␈α
at␈α
the␈α
current␈α
arm␈α
position,␈α
this␈α
is␈α
an␈α
implicit␈α
parameter␈α
to␈α
the␈α
motion␈α
specification
␈↓ ↓H␈↓which␈α
may␈α∞not␈α
agree␈α∞with␈α
its␈α∞planning␈α
value.␈α
 This␈α∞is␈α
a␈α∞special␈α
case␈α∞of␈α
a␈α∞general␈α
phenomenon:
␈↓ ↓H␈↓objects␈αare␈αseldom␈αexactly␈αwhere␈αthey␈αwere␈αplanned␈αto␈αbe,␈αand␈αthe␈αruntime␈αvalue␈αof␈αtheir␈αframes
␈↓ ↓H␈↓will␈α∞very␈α∂likely␈α∞be␈α∂based␈α∞on␈α∂the␈α∞position␈α∂of␈α∞the␈α∂hand␈α∞after␈α∂it␈α∞successfully␈α∂locates␈α∞the␈α∂object␈α∞by
␈↓ ↓H␈↓sensory feedback.

␈↓ ↓H␈↓Thus␈αit␈αbecomes␈αnecessary␈αthat␈αthe␈αruntime␈αsystem␈αadjust␈αall␈αtrajectories␈αimmediately␈αbefore␈αthey
␈↓ ↓H␈↓are␈αexecuted.␈α Adjusting␈αa␈α
trajectory␈αis␈αless␈αtime-consuming␈α
than␈αthe␈αoriginal␈αcalculation;␈αit␈α
makes
␈↓ ↓H␈↓sense␈αto␈αadjust␈αbefore␈αeach␈αrepetition␈αof␈αa␈αmotion,␈αwhereas␈αit␈αwould␈αbe␈αa␈αwaste␈αof␈αcomputer␈αtime
␈↓ ↓H␈↓to␈α∞recalculate␈α∞trajectories␈α∞that␈α∞often.␈α∞ Immediately␈α∞before␈α∞the␈α∞arm␈α∞starts␈α∞moving␈α∞on␈α∞a␈α
trajectory,
␈↓ ↓H␈↓then,␈α∂the␈α∂plan␈α∞is␈α∂modified␈α∂to␈α∂bring␈α∞it␈α∂into␈α∂line␈α∞with␈α∂current␈α∂values␈α∂of␈α∞frames.␈α∂ If␈α∂there␈α∂is␈α∞any
␈↓ ↓H␈↓discrepancy␈α⊂between␈α⊂the␈α⊃runtime␈α⊂and␈α⊂compile-time␈α⊂understanding␈α⊃of␈α⊂where␈α⊂any␈α⊂frame␈α⊃is,␈α⊂the
␈↓ ↓H␈↓servo will try to place the arm in the right place nonetheless.

␈↓ ↓H␈↓There␈α⊂are␈α∂limits␈α⊂to␈α⊂the␈α∂proper␈α⊂use␈α⊂of␈α∂this␈α⊂feature;␈α⊂if␈α∂the␈α⊂planning␈α⊂value␈α∂is␈α⊂seriously␈α⊂in␈α∂error
␈↓ ↓H␈↓(which␈αcan␈αhappen␈α
if␈αthe␈αerror␈α
is␈αbut␈αa␈α
few␈αcentimeters,␈αdepending␈α
on␈αthe␈αarm␈α
being␈αused␈αand␈α
its
␈↓ ↓H␈↓configuration),␈α⊃then␈α⊃the␈α⊃attempt␈α⊂to␈α⊃make␈α⊃last-minute␈α⊃corrections␈α⊂might␈α⊃overstrain␈α⊃the␈α⊃arm␈α⊂or
␈↓ ↓H␈↓impair␈α
response␈αto␈α
directional␈α
forces.␈α It␈α
is␈α
the␈αuser's␈α
responsibility␈α
to␈αforesee␈α
large␈αdiscrepancies␈α
in
␈↓ ↓H␈↓the␈α∩planning␈α∩value␈α∪and␈α∩to␈α∩program␈α∩in␈α∪a␈α∩condition␈α∩to␈α∩select␈α∪one␈α∩of␈α∩several␈α∪possible␈α∩moves.
␈↓ ↓H␈↓Hopefully, this will be seldom needed.

␈↓ ↓H␈↓After␈α∂a␈α∂motion␈α∂has␈α∞been␈α∂completed,␈α∂the␈α∂new␈α∞location␈α∂of␈α∂the␈α∂hands␈α∞will␈α∂be␈α∂read,␈α∂and␈α∂that␈α∞will
␈↓ ↓H␈↓Page 26␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α9MOTIONS␈↓ ∂2.2.1



␈↓ ↓H␈↓determine␈αthe␈αnew␈αvalue␈αfor␈α␈↓βyellow␈↓␈αand␈α␈↓βblue␈↓,␈αas␈αwell␈αas␈αfor␈αany␈αframes␈αwhich␈αmight␈αbe␈αaffixed␈αto
␈↓ ↓H␈↓them.  For the moment, we will ignore affixments; they are discussed in great detail later.



␈↓ ↓H␈↓␈↓β2.2.2 SIMPLE MOVES␈↓

␈↓ ↓H␈↓In␈α∞this␈α
section␈α∞we␈α
will␈α∞discuss␈α
motions␈α∞which␈α∞are␈α
to␈α∞be␈α
executed␈α∞on␈α
only␈α∞one␈α
arm.␈α∞ Let␈α∞us␈α
start
␈↓ ↓H␈↓with an example:

␈↓ ↓H␈↓        FRAME frobgrasp, swing1, swing2;
␈↓ ↓H␈↓        :
␈↓ ↓H␈↓        MOVE yellow
␈↓ ↓H␈↓                TO frobgrasp
␈↓ ↓H␈↓                VIA swing1, swing2

␈↓ ↓H␈↓This␈α
example␈α
demonstrates␈α
the␈αgeneral␈α
syntax;␈α
the␈α
reserved␈α
word␈αMOVE␈α
is␈α
followed␈α
by␈αthe␈α
name
␈↓ ↓H␈↓of␈α
the␈α
arm␈α
to␈αbe␈α
moved␈α
and␈α
a␈α
set␈αof␈α
clauses,␈α
each␈α
beginning␈α
with␈αa␈α
reserved␈α
word␈α
(here␈αthe␈α
words
␈↓ ↓H␈↓TO␈αand␈αVIA).␈α
 There␈αis␈αno␈α
punctuation␈αnecessary␈αat␈α
the␈αend␈αof␈α
a␈αclause.␈α The␈α
arm␈αis␈αexpected␈α
to
␈↓ ↓H␈↓travel␈αfrom␈αits␈α
current␈αposition␈α(wherever␈αthat␈α
is␈αplanned␈αto␈αbe)␈α
to␈αthe␈αfinal␈α
position␈α(␈↓βfrobgrasp␈↓),
␈↓ ↓H␈↓passing␈α⊂through␈α⊂the␈α⊂intermediate␈α⊂positions␈α⊃(␈↓βswing1␈↓␈α⊂and␈α⊂␈↓βswing2␈↓).␈α⊂ A␈α⊂smooth␈α⊂trajectory␈α⊃for␈α⊂the
␈↓ ↓H␈↓motion␈α⊗will␈α⊗be␈α↔computed␈α⊗by␈α⊗splining␈α⊗together␈α↔polynomial␈α⊗segments␈α⊗(usually␈α↔third␈α⊗degree,
␈↓ ↓H␈↓occasionally␈α
fourth)␈α
separately␈αfor␈α
each␈α
arm␈αjoint.␈α
 This␈α
trajectory␈αcalculation␈α
is␈α
somewhat␈αtime-
␈↓ ↓H␈↓consuming and is done completely at compile time.

␈↓ ↓H␈↓Certain␈α∂things␈α∂must␈α∂be␈α∂specified␈α∂for␈α∂any␈α∂move.␈α∂ First␈α∞is␈α∂the␈α∂arm␈α∂which␈α∂is␈α∂to␈α∂be␈α∂moved.␈α∂ It␈α∞is
␈↓ ↓H␈↓named␈αby␈αan␈αarm␈αframe␈α(␈↓βyellow␈↓␈αor␈α␈↓βblue␈↓);␈αother␈αways␈αof␈αspecifying␈αthe␈αarm␈αwill␈αbe␈αmentioned␈α
after
␈↓ ↓H␈↓the␈α
formal␈α
idea␈α
of␈α
affixment␈α
has␈α
been␈α
presented.␈α
Next,␈α
the␈α
destination␈α
frame␈α
must␈α∞be␈α
specified.
␈↓ ↓H␈↓"TO ␈↓βfrobgrasp␈↓"␈αmeans␈α
that␈αat␈α
the␈αend␈α
of␈αthe␈αmotion,␈α
the␈αposition␈α
of␈αthe␈α
arm␈αshould␈αcoincide␈α
with
␈↓ ↓H␈↓the␈α∩position␈α∪of␈α∩␈↓βfrobgrasp␈↓.␈α∩ There␈α∪is␈α∩a␈α∪notational␈α∩convenience␈α∩for␈α∪destinations:␈α∩They␈α∪can␈α∩be
␈↓ ↓H␈↓specified␈α∂in␈α∂terms␈α∂of␈α∂where␈α∂the␈α∞arm␈α∂is␈α∂at␈α∂the␈α∂start␈α∂of␈α∞the␈α∂motion.␈α∂ The␈α∂symbol␈α∂for␈α∂this␈α∂is␈α∞"⊗"
␈↓ ↓H␈↓(sometimes␈α
pronounced␈α
"grinch"),␈αthat␈α
is,␈α
⊗␈αis␈α
a␈α
frame␈αwhich␈α
has␈α
the␈αlocation␈α
and␈α
orientation␈αof
␈↓ ↓H␈↓the arm at the start of the motion. Thus,

␈↓ ↓H␈↓        MOVE yellow TO ⊗ + Z*CM

␈↓ ↓H␈↓will move the arm 1 centimeter in Z above its starting place.



␈↓ ↓H␈↓␈↓β2.2.3 CONDITION MONITORS␈↓

␈↓ ↓H␈↓During␈α⊂the␈α⊂course␈α⊂of␈α⊃an␈α⊂arm␈α⊂motion,␈α⊂it␈α⊃may␈α⊂be␈α⊂desired␈α⊂to␈α⊃monitor␈α⊂some␈α⊂condition␈α⊂or␈α⊃set␈α⊂of
␈↓ ↓H␈↓conditions␈α∪in␈α∪order␈α∪to␈α∪prematurely␈α∪stop␈α∪the␈α∩motion␈α∪or␈α∪inform␈α∪some␈α∪parallel␈α∪process␈α∪that␈α∩a
␈↓ ↓H␈↓condition␈αhas␈αoccurred.␈α The␈αconditions␈αwhich␈αmay␈αbe␈αchecked␈αare␈αresults␈αof␈αmeasurements,␈αsuch
␈↓ ↓H␈↓as␈α⊃time␈α⊂or␈α⊃force␈α⊃checking,␈α⊂and␈α⊃␈↓βevents␈↓,␈α⊃which␈α⊂are␈α⊃signals␈α⊂that␈α⊃can␈α⊃be␈α⊂explicitly␈α⊃sent␈α⊃by␈α⊂other
␈↓ ↓H␈↓simultaneous␈α↔processes.␈α↔ Events␈α⊗will␈α↔be␈α↔discussed␈α⊗in␈α↔subsection␈α↔2.5.4;␈α⊗for␈α↔the␈α↔time␈α⊗being,
␈↓ ↓H␈↓assume␈α
that␈α
the␈α
only␈α
conditions␈α
which␈α
may␈α
be␈α
checked␈α
are␈α
measurement␈α
conditions.␈α
 Here␈α
is␈αan
␈↓ ↓H␈↓example which contains some ␈↓βcondition monitors␈↓:
␈↓ ↓H␈↓2.2.3␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α∩MOTIONS␈↓ 
aPage 27



␈↓ ↓H␈↓        SCALAR warning;
␈↓ ↓H␈↓        VECTOR v1;
␈↓ ↓H␈↓        :
␈↓ ↓H␈↓        MOVE yellow
␈↓ ↓H␈↓                TO ypark
␈↓ ↓H␈↓                ON DURATION ≥ 3*SEC DO warning ← 1
␈↓ ↓H␈↓                ON FORCE(v1) ≥ 18*OZ DO STOP {␈↓βStops the arm␈↓}

␈↓ ↓H␈↓This␈α∂motion␈α∂has␈α∂two␈α∞separate␈α∂and␈α∂independent␈α∂condition␈α∂monitors;␈α∞the␈α∂first␈α∂will␈α∂trigger␈α∂if␈α∞the
␈↓ ↓H␈↓motion␈α
takes␈α
longer␈α
than␈α
three␈α
seconds,␈α
and␈α
the␈α
second␈α
will␈α
trigger␈α
if␈α
the␈α
force␈α
on␈α
the␈α∞hand,␈α
as
␈↓ ↓H␈↓measured␈α
along␈α
vector␈α
␈↓βv1␈↓,␈α
exceeds␈α
18␈α
ounces.␈α
(Assume␈α
we␈α
have␈α
a␈α
macro␈α
which␈α
translates␈αounces
␈↓ ↓H␈↓into␈αunits␈αof␈αforce.)␈αThe␈α␈↓βconclusion␈↓␈αof␈αa␈αcondition␈αmonitor,␈αthe␈αcode␈αwhich␈αwill␈αbe␈αexecuted␈αif␈αthe
␈↓ ↓H␈↓monitor triggers, is one statement prefaced with the reserved word DO.

␈↓ ↓H␈↓A␈α
condition␈α
monitor␈α
has␈α
two␈α
states:␈α
␈↓βenabled␈↓␈α
and␈α
␈↓βdisabled␈↓.␈α
Generally,␈α
a␈α
condition␈α
monitor␈α∞will␈α
be
␈↓ ↓H␈↓enabled␈αas␈αsoon␈αas␈αits␈αmotion␈αstatement␈αis␈αstarted,␈αand␈αit␈αbecomes␈αdisabled␈αwhen␈αthe␈αmotion␈αends.
␈↓ ↓H␈↓As␈αsoon␈α
as␈αa␈α
condition␈αmonitor␈αtriggers,␈α
it␈αbecomes␈α
disabled␈αunless␈α
it␈αbecomes␈αexplicitly␈α
reenabled.
␈↓ ↓H␈↓Reenabling is done by executing the statement ENABLE within the conclusion.

␈↓ ↓H␈↓In␈αorder␈αto␈α
enable␈αor␈αdisable␈α
some␈αarbitrary␈αmonitor,␈α
it␈αis␈αnecessary␈α
to␈αgive␈αit␈α
a␈αname;␈αthis␈αis␈α
done
␈↓ ↓H␈↓by␈αputting␈αa␈α␈↓βlabel␈↓␈αimmediately␈αbefore␈αthe␈αword␈αON.␈α A␈αlabel␈αis␈αan␈αundeclared␈αidentifier␈αfollowed
␈↓ ↓H␈↓by a colon.  Thus we could write:

␈↓ ↓H␈↓        MOVE blue TO frobgrasp
␈↓ ↓H␈↓                test1: ON DURATION ≥ 3*SEC DO DISABLE test2
␈↓ ↓H␈↓                test2: ON TEMPERATURE < 30 DO STOP

␈↓ ↓H␈↓Thus, test2 is only performed for the first three seconds.

␈↓ ↓H␈↓Occasionally␈α⊃one␈α⊃wants␈α⊃to␈α⊃write␈α⊃a␈α⊂condition␈α⊃monitor␈α⊃which␈α⊃is␈α⊃initially␈α⊃disabled␈α⊃and␈α⊂becomes
␈↓ ↓H␈↓enabled later.  This is accomplished by putting the word DEFER before ON:

␈↓ ↓H␈↓        fudge: ON temperature > 400 DO
␈↓ ↓H␈↓                BEGIN  {␈↓βKeep shouting until someone hears.␈↓}
␈↓ ↓H␈↓                WRITE("BURNING");
␈↓ ↓H␈↓                STOP OVEN;  {␈↓βPretend we have a device OVEN␈↓}
␈↓ ↓H␈↓                ENABLE  {␈↓βThis reenables ␈↓fudge}
␈↓ ↓H␈↓                END
␈↓ ↓H␈↓        taste: DEFER ON cooked {␈↓βThis is an event.␈↓} DO DISABLE fudge
␈↓ ↓H␈↓        ON DURATION > 30*MIN DO ENABLE taste

␈↓ ↓H␈↓It␈α
should␈α
be␈α
noted␈α
that␈α
this␈α
ability␈αto␈α
enable␈α
and␈α
disable␈α
monitors␈α
explicitly␈α
is␈α
a␈αnon-structured
␈↓ ↓H␈↓construct;␈αusing␈αit␈αcan␈αlead␈αto␈αunintelligible␈αprograms.␈α In␈αany␈αcase,␈αscope␈αrules␈αmust␈αbe␈αobserved;
␈↓ ↓H␈↓it␈αis␈αnot␈αlegal␈αto␈αenable␈αor␈αdisable␈αmonitors␈αacross␈αdifferent␈αMOVE␈αstatements.␈α This␈αmeans␈αthat
␈↓ ↓H␈↓two␈αmotion␈αstatements␈αwhich␈αhappen␈αto␈αbe␈αsimultaneously␈αexecuting␈α(we␈αshall␈αsee␈αhow␈αto␈αdo␈αthis
␈↓ ↓H␈↓later, in subsection 2.5.2) cannot interfere with each other's condition monitors.

␈↓ ↓H␈↓Boolean␈αcombinations␈αof␈αconditions␈αare␈αnot␈αallowed.␈α Some␈αof␈αthe␈αcontinually␈αmeasured␈αfunctions
␈↓ ↓H␈↓Page 28␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α9MOTIONS␈↓ ∂2.2.3



␈↓ ↓H␈↓which␈αmay␈α
be␈αtested␈αare␈α
force␈αalong␈αa␈α
vector,␈α(FORCE(V)),␈αforce␈α
about␈αan␈α
axis␈α(TORQUE(V)),
␈↓ ↓H␈↓time␈α∞since␈α∞beginning␈α∞of␈α∞motion␈α∞(DURATION),␈α∞and␈α∞the␈α∞force␈α∞between␈α∞the␈α∂fingers␈α∞(SQUEEZE).
␈↓ ↓H␈↓One␈αstandard␈αevent␈αis␈α
testable:␈αARRIVAL.␈α This␈αevent␈αoccurs␈α
when␈αthe␈αmotion␈αterminates␈αdue␈α
to
␈↓ ↓H␈↓having␈α
reached␈α
its␈α
destination.␈α
 It␈α∞does␈α
␈↓βnot␈↓␈α
become␈α
true␈α
if␈α∞the␈α
arm␈α
stops␈α
for␈α
reasons␈α∞other␈α
than
␈↓ ↓H␈↓normal arrival at the destination; STOP does not trigger it.

␈↓ ↓H␈↓The␈αconclusion␈α
of␈αa␈α
condition␈αmonitor␈α
may␈αbe␈α
any␈αstatement,␈α
including␈αan␈α
entire␈αblock.␈α The␈α
only
␈↓ ↓H␈↓restriction␈α∩is␈α∩that␈α∩if␈α∩a␈α∩motion␈α∩statement␈α∩is␈α∩the␈α∩only␈α∩statement␈α∩in␈α∩the␈α∩conclusion,␈α∩it␈α∪must␈α∩be
␈↓ ↓H␈↓surrounded␈α
by␈α
BEGIN␈α
and␈α
END.␈α
 (This␈α
is␈α
necessary␈α
at␈α
times␈α
to␈α
prevent␈α
ambiguity.)␈α
The␈α
compiler
␈↓ ↓H␈↓will␈α∪complain␈α∪if␈α∪you␈α∀try␈α∪to␈α∪embed␈α∪a␈α∪motion␈α∀statement␈α∪inside␈α∪another␈α∪if␈α∪the␈α∀result␈α∪implies
␈↓ ↓H␈↓simultaneous motion statements for the same device.

␈↓ ↓H␈↓The␈α
existence␈α
of␈αcondition␈α
monitors␈α
raises␈α
this␈αquestion:␈α
When␈α
is␈αthe␈α
motion␈α
really␈α
finished?␈α It
␈↓ ↓H␈↓can␈αhappen␈αthat␈αthe␈αarm␈αitself␈αhas␈αstopped,␈αbut␈αsome␈αmonitor␈αhas␈αtriggered,␈αand␈αits␈αconclusion␈αis
␈↓ ↓H␈↓still␈αbusy␈αbeing␈αexecuted.␈α The␈αrule␈αis␈αthis:␈αthe␈αmotion␈αis␈αdeclared␈αdone␈αwhen␈αall␈αthe␈αjoints␈αof␈αthe
␈↓ ↓H␈↓arm␈α∞are␈α∞stopped,␈α∞and␈α
all␈α∞monitors␈α∞are␈α∞either␈α∞disabled␈α
or␈α∞not␈α∞currently␈α∞triggered.␈α∞ Any␈α
monitors
␈↓ ↓H␈↓still enabled, but not triggered, are disabled at the time that the motion is declared finished.

␈↓ ↓H␈↓The␈α∩user␈α⊃must␈α∩be␈α⊃aware␈α∩of␈α⊃some␈α∩timing␈α⊃considerations.␈α∩ Firstly,␈α⊃measurements␈α∩like␈α⊃FORCE,
␈↓ ↓H␈↓DURATION,␈α
and␈αSQUEEZE␈α
are␈αnot␈α
really␈αcomputed␈α
continually;␈αthere␈α
is␈αa␈α
process␈αwhich␈α
makes
␈↓ ↓H␈↓a␈α∞measurement␈α∂and␈α∞then␈α∂lies␈α∞dormant␈α∞for␈α∂a␈α∞while␈α∂(on␈α∞the␈α∞order␈α∂of␈α∞twenty␈α∂milliseconds)␈α∞before
␈↓ ↓H␈↓again␈αmaking␈α
a␈αmeasurement.␈α Thus,␈α
monitors␈αdo␈α
not␈αtrigger␈αimmediately␈α
when␈αa␈αtested␈α
condition
␈↓ ↓H␈↓becomes␈α
true.␈α
 Secondly,␈α
when␈α
a␈α
monitor␈αtriggers,␈α
any␈α
initial␈α
statements␈α
of␈α
enabling␈α
or␈αdisabling
␈↓ ↓H␈↓are␈α
done␈α
immediately,␈α
but␈αany␈α
arithmetic␈α
is␈α
scheduled␈αto␈α
be␈α
done␈α
at␈αsome␈α
point␈α
in␈α
the␈αnear␈α
future.
␈↓ ↓H␈↓Therefore␈α
it␈α
is␈α
not␈αpossible␈α
to␈α
guarantee␈α
that␈α
a␈αcritical␈α
computation␈α
happen␈α
immediately.␈α
 If␈αthe
␈↓ ↓H␈↓user␈αdesires,␈αhe␈αmay␈αuse␈αthe␈αword␈αCRITICAL␈αat␈αthe␈αstart␈αof␈αthe␈αconclusion,␈αand␈αUNCRITICAL
␈↓ ↓H␈↓at␈αthe␈α
start␈αof␈α
that␈αcode␈α
which␈αneed␈α
not␈αbe␈α
guaranteed␈αimmediate␈α
execution.␈α Only␈αone␈α
occurrence
␈↓ ↓H␈↓of␈αCRITICAL,␈αat␈αthe␈αvery␈αstart␈αof␈αthe␈αconclusion,␈αand␈αonly␈αone␈αoccurrence␈αof␈αUNCRITICAL␈α
are
␈↓ ↓H␈↓allowed.␈α⊗ 'AL␈α⊗automatically␈α⊗assumes␈α⊗CRITICAL␈α⊗before␈α⊗initial␈α⊗statements␈α⊗of␈α⊗enabling␈α⊗and
␈↓ ↓H␈↓disabling, and UNCRITICAL immediately following.  An example:

␈↓ ↓H␈↓        ON DURATION ≥ 4*SEC DO          {␈↓βTested frequently␈↓}
␈↓ ↓H␈↓                BEGIN
␈↓ ↓H␈↓                ENABLE goodguy;         {␈↓βAssumed CRITICAL␈↓}
␈↓ ↓H␈↓                t ← 3;                  {␈↓βAssumed UNCRITICAL␈↓}
␈↓ ↓H␈↓                END
␈↓ ↓H␈↓        ON SQUEEZE ≥ 10*OZ DO           {␈↓βTested frequently␈↓}
␈↓ ↓H␈↓                BEGIN
␈↓ ↓H␈↓                CRITICAL;               {␈↓βOverrides defaults␈↓}
␈↓ ↓H␈↓                t ← 4;                  {␈↓βWill be done immediately␈↓}
␈↓ ↓H␈↓                UNCRITICAL;             {␈↓βEnd of critical region␈↓}
␈↓ ↓H␈↓                DISABLE goodguy;        {␈↓βDone soon␈↓}
␈↓ ↓H␈↓                END
␈↓ ↓H␈↓2.2.4␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α∩MOTIONS␈↓ 
aPage 29



␈↓ ↓H␈↓␈↓β2.2.4 FORCE DURING A MOTION␈↓

␈↓ ↓H␈↓To␈α∂make␈α∂the␈α⊂arm␈α∂compliant␈α∂to␈α⊂external␈α∂forces␈α∂along␈α⊂some␈α∂directions␈α∂or␈α⊂about␈α∂some␈α∂axis␈α⊂it␈α∂is
␈↓ ↓H␈↓necessary␈αto␈αspecify␈α
the␈αappropriate␈αmodes␈αof␈α
freedom.␈α Because␈α'AL␈αworks␈α
in␈αthree-dimensional
␈↓ ↓H␈↓space,␈α
it␈α
only␈α
makes␈αsense␈α
to␈α
specify␈α
at␈α
most␈αthree␈α
orthogonal␈α
directions␈α
and␈α
three␈αorthogonal␈α
axes.
␈↓ ↓H␈↓In␈αaddition␈αto␈αbeing␈α
compliant␈αalong␈αdegrees␈αof␈αfreedom␈α
(whether␈αtranslational␈αor␈αrotational),␈αit␈α
is
␈↓ ↓H␈↓also␈α∞useful␈α∞to␈α∞apply␈α∞a␈α∂fixed␈α∞force␈α∞along␈α∞some␈α∞of␈α∂these␈α∞degrees.␈α∞ Then␈α∞pure␈α∞freedom␈α∂reduces␈α∞to
␈↓ ↓H␈↓application of zero force.

␈↓ ↓H␈↓For␈αexample,␈αsuppose␈αthe␈αarm␈αis␈αon␈αthe␈αsurface␈αof␈αthe␈αstation;␈αwe␈αwish␈αto␈αapply␈αa␈αforce␈αof␈α10000
␈↓ ↓H␈↓dynes␈α⊂directly␈α⊃downward␈α⊂(the␈α⊃negative␈α⊂Z␈α⊃direction)␈α⊂while␈α⊂allowing␈α⊃the␈α⊂arm␈α⊃to␈α⊂comply␈α⊃to␈α⊂any
␈↓ ↓H␈↓horizontal force.  This is how we would write such a motion:

␈↓ ↓H␈↓        MOVE blue TO ⊗  {␈↓βmoves nowhere␈↓}
␈↓ ↓H␈↓                WITH DURATION = 10*SEC  {␈↓βgive it some time.␈↓}
␈↓ ↓H␈↓                WITH FORCE = -10000*DYNES ALONG Z OF station
␈↓ ↓H␈↓                WITH FORCE = 0 ALONG X, Y OF station

␈↓ ↓H␈↓This␈α
example␈α
illustrates␈α
several␈α∞conventions.␈α
 A␈α
translational␈α
degree␈α∞of␈α
force␈α
(or␈α
freedom,␈α∞if␈α
the
␈↓ ↓H␈↓amount␈α∂of␈α⊂force␈α∂is␈α∂zero)␈α⊂is␈α∂specified␈α∂by␈α⊂the␈α∂word␈α∂ALONG␈α⊂followed␈α∂by␈α∂a␈α⊂list␈α∂which␈α⊂can␈α∂only
␈↓ ↓H␈↓contain␈α∞the␈α∂vectors␈α∞X,␈α∂Y,␈α∞and␈α∂Z,␈α∞followed␈α∂by␈α∞the␈α∞word␈α∂OF␈α∞and␈α∂the␈α∞name␈α∂of␈α∞the␈α∂frame␈α∞which
␈↓ ↓H␈↓specifies␈αthe␈αcoordinate␈αsystem␈α
in␈αwhich␈αthe␈αcardinal␈αaxes␈α
are␈αto␈αbe␈αunderstood.␈α The␈α
amount␈αof
␈↓ ↓H␈↓force␈αmust␈α
be␈αin␈α
force␈αunits,␈α
which␈αare␈α
of␈αthe␈α
scalar␈αdimension␈α
␈↓βmass*distance/(time*time)␈↓;␈αwe␈α
have
␈↓ ↓H␈↓assumed in the example above that DYNES is a macro which expands to correct units.

␈↓ ↓H␈↓Rotational␈αdegrees␈αof␈α
force␈αare␈αwritten␈α
in␈αmuch␈αthe␈α
same␈αway;␈αthe␈α
axes␈αare␈αspecified␈α
ABOUT␈αa
␈↓ ↓H␈↓combination of X, Y, and Z OF some frame, like this:

␈↓ ↓H␈↓        WITH FORCE = 5000*DYNES ABOUT Z OF ⊗
␈↓ ↓H␈↓␈↓ βλ␈↓β{Applies a torque about the Z direction of the hand.}

␈↓ ↓H␈↓During␈αa␈α
motion␈αwhich␈αhas␈α
only␈αtranslational␈αforce␈α
specifications,␈αthe␈αorientation␈α
of␈αthe␈αhand␈α
will
␈↓ ↓H␈↓remain␈αas␈αplanned,␈αbut␈αthe␈αlocation␈αwill␈αcomply␈αwith␈αthe␈αspecified␈αforce.␈α During␈αa␈αmotion␈αwhich
␈↓ ↓H␈↓has␈αrotational␈αdegrees␈αof␈αforce,␈αthe␈αorientation␈αof␈αthe␈αhand␈αwill␈αvary␈αfrom␈αthat␈αplanned␈αin␈αaccord
␈↓ ↓H␈↓with the specification and whatever external forces are encountered.

␈↓ ↓H␈↓It␈α∂does␈α∞not␈α∂really␈α∞make␈α∂sense␈α∞to␈α∂have␈α∂a␈α∞force␈α∂in␈α∞the␈α∂nominal␈α∞direction␈α∂of␈α∞motion,␈α∂but␈α∂there␈α∞is
␈↓ ↓H␈↓neither␈αa␈αcompile-time␈αnor␈αa␈αruntime␈αcheck␈αto␈αcatch␈αsuch␈αusage.␈α If␈αit␈αhappens,␈αthe␈αarm␈αcould␈αgo
␈↓ ↓H␈↓into oscillation.

␈↓ ↓H␈↓Actually,␈αnot␈αall␈αof␈α
the␈αfull␈αpower␈αof␈α
force␈αspecifications␈αwill␈αbe␈α
available␈αin␈αthe␈αfirst␈α
versions␈αof
␈↓ ↓H␈↓'AL.␈α In␈αparticular,␈αrotational␈αspecifications␈αwill␈αbe␈αhandled␈αroughly␈αor␈αnot␈αat␈αall.␈α Another␈αfuture
␈↓ ↓H␈↓embellishment␈αwill␈αbe␈αto␈αallow␈αthe␈αdirections␈αof␈αforce␈αto␈αvary␈αduring␈αthe␈αmotion;␈αthis␈αis␈αuseful␈αfor
␈↓ ↓H␈↓such tasks as turning a crank.  For example, the following will eventually be available:

␈↓ ↓H␈↓        MOVE yellow TO frobgrasp
␈↓ ↓H␈↓                WITH FORCE = SIN(DURATION*DEG)*10000*DYNES
␈↓ ↓H␈↓                        ALONG Z OF @;
␈↓ ↓H␈↓Page 30␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α9MOTIONS␈↓ ∂2.2.4



␈↓ ↓H␈↓This␈α
specifies␈α
a␈α
varying␈α
amount␈α
of␈α
force␈α
along␈α
a␈α
varying␈α
direction:␈α
"@"␈α
means␈α
"the␈α
␈↓βcurrent␈↓␈α
location
␈↓ ↓H␈↓of the hand, as it changes during the motion."

␈↓ ↓H␈↓Especially␈α⊂at␈α⊃first,␈α⊂some␈α⊂of␈α⊃the␈α⊂force␈α⊂control␈α⊃will␈α⊂be␈α⊂prepared␈α⊃by␈α⊂the␈α⊂compiler,␈α⊃not␈α⊂calculated
␈↓ ↓H␈↓during␈α∞the␈α∞arm␈α∞motion␈α∞itself.␈α∞ Therefore,␈α∞if␈α∂the␈α∞runtime␈α∞values␈α∞of␈α∞the␈α∞endpoints␈α∞of␈α∂motion␈α∞are
␈↓ ↓H␈↓significantly at odds with their planning values, application of force may go awry.



␈↓ ↓H␈↓␈↓β2.2.5 DEPROACHES␈↓

␈↓ ↓H␈↓Many␈α∞objects␈α∞have␈α∞shapes␈α∞which␈α∞necessitate␈α∂care␈α∞as␈α∞the␈α∞arm␈α∞approaches␈α∞them␈α∞or␈α∂departs␈α∞from
␈↓ ↓H␈↓them.␈α∞ 'AL␈α∞supplies␈α∞a␈α∞method␈α∞for␈α∞insuring␈α∞that␈α
every␈α∞time␈α∞the␈α∞arm␈α∞approaches␈α∞a␈α∞frame,␈α∞it␈α
will
␈↓ ↓H␈↓pass␈α∞through␈α∞an␈α∂associated␈α∞spot␈α∞first,␈α∂and␈α∞every␈α∞time␈α∂it␈α∞leaves␈α∞that␈α∂frame,␈α∞it␈α∞passes␈α∂once␈α∞again
␈↓ ↓H␈↓through␈α∞the␈α
same␈α∞spot.␈α
 The␈α∞"spot"␈α
is␈α∞termed␈α
a␈α∞␈↓βdeproach␈↓␈α
(from␈α∞␈↓βdep␈↓arture␈α
and␈α∞ap␈↓βproach␈↓);␈α
it␈α∞is␈α
a
␈↓ ↓H␈↓transformation␈α∂to␈α∂be␈α∞applied␈α∂to␈α∂the␈α∂frame␈α∞involved␈α∂in␈α∂order␈α∞to␈α∂discover␈α∂the␈α∂appropriate␈α∞place
␈↓ ↓H␈↓through␈αwhich␈α
to␈αpass.␈α
 The␈αfact␈α
that␈αa␈α
trans␈αis␈α
used␈αimplies␈α
that␈αthe␈α
deproach␈αpoint␈α
will␈αmove
␈↓ ↓H␈↓about␈αwith␈αits␈αframe.␈α It␈αalso␈αmeans␈αthat␈αthe␈αlocation␈αof␈αthe␈αdeproach␈αpoint␈αis␈αrelative␈αnot␈α
to␈αthe
␈↓ ↓H␈↓origin␈αof␈αthe␈αframe,␈αbut␈αrather␈αto␈αthe␈αpoint␈αin␈αframe␈αcoordinates␈αto␈αwhich␈αthe␈αmotion␈αleads.␈α For
␈↓ ↓H␈↓example,␈αthe␈αdeproach␈αtransformation␈αof␈αthe␈αstation␈αis␈αTRANS(VECTOR(0,0,10*CM),NILROT).
␈↓ ↓H␈↓If␈αthe␈αarm␈αis␈αto␈αgo␈αto,␈αsay,␈αthe␈αpoint␈αVECTOR(3,1,4)+station␈αusing␈αstation's␈αdeproach,␈αthen␈αit␈αwill
␈↓ ↓H␈↓first␈α
go␈α
through␈α
VECTOR(3,1,14).␈α This␈α
has␈α
the␈α
effect␈α
of␈αpreventing␈α
the␈α
arm␈α
from␈αgoing␈α
through
␈↓ ↓H␈↓the surface of the station.

␈↓ ↓H␈↓The␈αdeproach␈αof␈αa␈αframe␈αis␈αspecified␈αby␈αmeans␈αof␈αan␈αassertion.␈α Without␈αgoing␈αinto␈αfull␈αdetail␈α
on
␈↓ ↓H␈↓assertions (which will be covered in detail in Section 3.4), we give some examples:

␈↓ ↓H␈↓        ASSERT FORM(DEPROACH, station, TRANS(NILROT,VECTOR(0,0,10*CM));
␈↓ ↓H␈↓␈↓ βλ␈↓β{This is preasserted and need never be included.}
␈↓ ↓H␈↓        ASSERT FORM(DEPROACH, frob, TRANS(ROT(X,90*DEG),VECTOR(1,0,0)));
␈↓ ↓H␈↓␈↓ βλ␈↓β{Whenever␈α∪you␈α∀go␈α∪to␈α∪frob,␈α∀go␈α∪through␈α∪a␈α∀point␈α∪90␈α∪degrees␈α∀about␈α∪frob's␈α∀X␈α∪axis
␈↓ ↓H␈↓β␈↓ βλfrom a spot one centimeter in X from the nominal arrival point.}

␈↓ ↓H␈↓Note␈α
that␈α
since␈α
deproaches␈α
are␈α
transformations,␈αthey␈α
have␈α
the␈α
power␈α
to␈α
include␈α
rotations.␈αThese
␈↓ ↓H␈↓are␈α∂considered␈α∂to␈α∞be␈α∂rotations␈α∂about␈α∂the␈α∞origin␈α∂of␈α∂the␈α∞coordinate␈α∂system␈α∂involved;␈α∂the␈α∞rotation
␈↓ ↓H␈↓occurs,␈α
as␈α
usual,␈α
before␈α
translation.␈α
 The␈α
use␈α
of␈α
rotations␈α
is␈α
of␈α
marginal␈α
use,␈α
but␈α
is␈α∞included␈α
for
␈↓ ↓H␈↓completeness.

␈↓ ↓H␈↓The␈α∂deproach␈α⊂points␈α∂of␈α⊂the␈α∂departure␈α⊂frame␈α∂and␈α⊂the␈α∂arrival␈α⊂frame␈α∂are␈α⊂used␈α∂as␈α⊂implicit␈α∂VIA
␈↓ ↓H␈↓points␈α⊂for␈α⊂any␈α∂motion,␈α⊂except␈α⊂when␈α∂the␈α⊂destination␈α⊂is␈α∂"⊗"␈α⊂or␈α⊂there␈α∂is␈α⊂an␈α⊂overriding␈α∂deproach
␈↓ ↓H␈↓clause in the motion statement.  Here are some examples:
␈↓ ↓H␈↓2.2.5␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α∩MOTIONS␈↓ 
aPage 31



␈↓ ↓H␈↓        MOVE yellow TO ⊗;  {␈↓βNo departure or approach point used␈↓}

␈↓ ↓H␈↓        MOVE yellow TO frob
␈↓ ↓H␈↓                WITH APPROACH = NILDEPROACH;
␈↓ ↓H␈↓␈↓ ∧λ␈↓β{The␈α⊗default␈α⊗departure␈α⊗(which␈α⊗depends␈α∃on␈α⊗the␈α⊗last␈α⊗motion␈α⊗made␈α∃by
␈↓ ↓H␈↓β␈↓ ∧λyellow) is used, but no approach point is desired.}

␈↓ ↓H␈↓        MOVE blue TO frob
␈↓ ↓H␈↓                WITH DEPARTURE = NILDEPROACH
␈↓ ↓H␈↓                WITH APPROACH = DEPROACH(frobgrasp);
␈↓ ↓H␈↓␈↓ ∧λ␈↓β{No␈α∪departure␈α∩point␈α∪is␈α∩desired,␈α∪but␈α∪the␈α∩approach␈α∪should␈α∩be␈α∪as␈α∪if␈α∩the
␈↓ ↓H␈↓β␈↓ ∧λdestination were frobgrasp, not frob.}


␈↓ ↓H␈↓Suppose␈αthat␈αa␈αframe␈αf␈α
is␈αgiven␈αdeproach␈αtransformation␈αd.␈α It␈α
is␈αdesired␈αto␈αfind␈αthe␈αframe␈α
which
␈↓ ↓H␈↓is␈α
the␈αdeproach␈α
point␈αfrom␈α
some␈αother␈α
frame␈α
h␈α(for␈α
example,␈αwhere␈α
the␈αhand␈α
is,␈α
for␈αdeparture),
␈↓ ↓H␈↓using f's deproach.  The frame which will be used as a via point is this:

␈↓ ↓H␈↓        f  *  d  * (f → station)  *  h    .


␈↓ ↓H␈↓The␈α⊂deproach␈α⊃point␈α⊂for␈α⊂f␈α⊃itself␈α⊂is␈α⊂discovered␈α⊃by␈α⊂setting␈α⊂h = f␈α⊃in␈α⊂the␈α⊂above␈α⊃expression.␈α⊂ The
␈↓ ↓H␈↓identities

␈↓ ↓H␈↓        (f → station) * f = station, and a * station = a     .

␈↓ ↓H␈↓reduce the resulting expression to f * d; this is therefore f's own deproach point.

␈↓ ↓H␈↓We␈αhave␈αnot␈αyet␈αdiscussed␈αaffixment␈αof␈αframes,␈αbut␈αthe␈αactual␈αdecision␈αof␈αwhich␈αdeproach␈αto␈αuse
␈↓ ↓H␈↓in␈αa␈αgiven␈αsituation␈αdepends␈αon␈αit␈αsomewhat,␈αso␈αlet␈αus␈αjust␈αmention␈αthat␈αthere␈αis␈αa␈αway␈αto␈αspecify
␈↓ ↓H␈↓that␈α∂two␈α∂frames␈α∂are␈α∂affixed,␈α∂so␈α∂that␈α∂whenever␈α∂on␈α∂moves,␈α∂so␈α∂does␈α∂the␈α∂other.␈α∂ Exact␈α∂details␈α∂are
␈↓ ↓H␈↓given␈α⊂in␈α⊃Section␈α⊂2.3.␈α⊂ With␈α⊃this␈α⊂understanding,␈α⊂we␈α⊃can␈α⊂describe␈α⊂the␈α⊃method␈α⊂used␈α⊃to␈α⊂describe
␈↓ ↓H␈↓how 'AL determines what deproach to use:

␈↓ ↓H␈↓When␈αan␈α
arm␈αmoves␈α
␈↓βto␈↓␈αa␈αframe,␈α
the␈αframe's␈α
own␈αdeproach␈αis␈α
used,␈αif␈α
it␈αhas␈αone.␈α
 If␈αnot,␈α
then␈αa
␈↓ ↓H␈↓search␈αis␈αmade␈αalong␈αthe␈αstring␈αof␈αaffixments␈α(that␈αis,␈αframes␈αto␈αwhich␈αthe␈αgiven␈αframe␈αis␈αaffixed
␈↓ ↓H␈↓are␈αsearched)␈α
until␈αone␈α
is␈αfound␈α
which␈αhas␈αa␈α
deproach.␈α That␈α
deproach␈αis␈α
the␈αone␈α
that␈αis␈αused.␈α
 If
␈↓ ↓H␈↓none␈αat␈αall␈αis␈αfound,␈α
then␈αthe␈αstation's␈αdeproach␈αis␈α
used␈αas␈αa␈αdefault.␈α (One␈α
way␈αto␈αthink␈αof␈αthis␈α
is
␈↓ ↓H␈↓to␈α
consider␈α
all␈α
frames␈α
ultimately␈α
affixed␈α
to␈αthe␈α
station.)␈α
In␈α
approaching␈α
a␈α
frame␈α
which␈α
is␈αthe␈α
result
␈↓ ↓H␈↓of a calculation, as in

␈↓ ↓H␈↓        MOVE yellow TO frob + VECTOR(0,0,1)     ,

␈↓ ↓H␈↓the default approach is NILDEPROACH.  The default deproach of ⊗ is also null.

␈↓ ↓H␈↓In␈αdeparting␈α␈↓βfrom␈↓␈αa␈αframe,␈αit␈αmatters␈αwhether␈αor␈αnot␈αthat␈αframe␈αis␈αnow␈αattached␈αto␈αthe␈αhand.␈α If
␈↓ ↓H␈↓not,␈α
then␈α
the␈α
same␈α
algorithm␈α
used␈α
for␈α
finding␈αdeparture␈α
is␈α
used␈α
for␈α
approach.␈α
But␈α
if␈α
the␈αframe
␈↓ ↓H␈↓has␈α∂been␈α∂detached␈α∂from␈α∂some␈α∂erstwhile␈α∂mother␈α∂and␈α∂is␈α∂now␈α∂attached␈α∂to␈α∂the␈α∂hand,␈α∂then␈α∂its␈α∞old
␈↓ ↓H␈↓Page 32␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α9MOTIONS␈↓ ∂2.2.5



␈↓ ↓H␈↓mother's␈α
deproach␈α
is␈α
used␈α
(and␈αif␈α
there␈α
is␈α
none,␈α
the␈α
same␈αsearch␈α
is␈α
made).␈α
 Thus,␈α
a␈αframe␈α
attached
␈↓ ↓H␈↓to the hand still has some "memory" of its previous state of attachment.



␈↓ ↓H␈↓␈↓β2.2.6 OTHER MOTION CLAUSES␈↓

␈↓ ↓H␈↓Here␈α∩we␈α∪describe␈α∩some␈α∪of␈α∩the␈α∪other␈α∩additional␈α∩clauses␈α∪that␈α∩may␈α∪be␈α∩associated␈α∪with␈α∩motion
␈↓ ↓H␈↓statements.␈α The␈αfirst␈αis␈αWITH␈αDURATION,␈αwhich␈αallows␈αthe␈αuser␈αto␈αspecify␈αthe␈αtiming␈αfor␈αthe
␈↓ ↓H␈↓motion.␈α
One␈αcan␈α
use␈α≥,=,␈α
or␈α≤␈α
for␈αduration␈α
control.␈α
 The␈αfirst␈α
is␈αused␈α
to␈αguarantee␈α
that␈αthe␈α
motion
␈↓ ↓H␈↓take␈α
a␈α
certain␈αamount␈α
of␈α
time,␈α
that␈αis,␈α
it␈α
guarantees␈α
that␈αthe␈α
motion␈α
will␈α
be␈αslow␈α
enough␈α
so␈αthat␈α
all
␈↓ ↓H␈↓the␈αtime␈α
is␈αused.␈α The␈α
second␈αis␈αrarer;␈α
it␈αis␈α
used␈αwhen␈αthe␈α
exact␈αtime␈αis␈α
somehow␈αcritical.␈α
 If␈αthe
␈↓ ↓H␈↓compiler␈α⊃thinks␈α⊂that␈α⊃the␈α⊃arm␈α⊂cannot␈α⊃move␈α⊂fast␈α⊃enough,␈α⊃it␈α⊂will␈α⊃complain.␈α⊂ The␈α⊃third␈α⊃form␈α⊂is
␈↓ ↓H␈↓included␈α∂primarily␈α∞for␈α∂completeness;␈α∞once␈α∂again,␈α∂it␈α∞can␈α∂cause␈α∞the␈α∂compiler␈α∞to␈α∂complain.␈α∂ In␈α∞the
␈↓ ↓H␈↓absence␈α
of␈α
any␈α
timing␈αspecification,␈α
'AL␈α
will␈α
compute␈α
the␈αleast␈α
time␈α
which␈α
will␈α
allow␈αthe␈α
particular
␈↓ ↓H␈↓arm being used to move most efficiently.

␈↓ ↓H␈↓VIA␈α∂is␈α∞used␈α∂to␈α∞name␈α∂desired␈α∞points␈α∂along␈α∞the␈α∂trajectory.␈α∞ In␈α∂its␈α∞simplest␈α∂form,␈α∞the␈α∂VIA␈α∞clause
␈↓ ↓H␈↓contains merely a list of frame expressions, such as in this example:

␈↓ ↓H␈↓        MOVE yellow TO finalpoint
␈↓ ↓H␈↓                VIA int1, int2 + VECTOR(0,0,1), int3;

␈↓ ↓H␈↓The␈α∩motion␈α∩will␈α∩be␈α∩planned␈α∩to␈α∩go␈α∩from␈α∩the␈α∩current␈α∩location␈α∩of␈α∩the␈α∩yellow␈α∩arm,␈α∩through␈α∩a
␈↓ ↓H␈↓departure␈αpoint␈α(if␈αthere␈αis␈αone),␈αthrough␈αeach␈αof␈αthe␈αintermediate␈αframes,␈αthrough␈α
the␈αapproach
␈↓ ↓H␈↓point (again, if there is one), and finally to arrive at finalpoint.

␈↓ ↓H␈↓At␈α
each␈α
of␈α
the␈αintermediate␈α
points,␈α
it␈α
is␈αpossible␈α
to␈α
specify␈α
the␈α
velocity␈αto␈α
be␈α
achieved␈α
at␈αthat␈α
point
␈↓ ↓H␈↓(in␈α∞terms␈α
of␈α∞a␈α
velocity␈α∞vector)␈α
as␈α∞well␈α
as␈α∞upper␈α
or␈α∞lower␈α
bounds␈α∞on␈α
the␈α∞time␈α
used␈α∞to␈α∞reach␈α
this
␈↓ ↓H␈↓frame from the previous one on the list.  Here is an example demonstrating these features:

␈↓ ↓H␈↓        MOVE blue TO finalpoint
␈↓ ↓H␈↓                VIA int1 WHERE VELOCITY = velo1, DURATION = 3*SEC
␈↓ ↓H␈↓                VIA int2 WHERE DURATION ≥ 7*SEC
␈↓ ↓H␈↓                WITH DURATION ≥ 10*SEC;

␈↓ ↓H␈↓This␈α∞specifies␈α∞two␈α∞intermediate␈α∞points,␈α∞each␈α∞of␈α∞which␈α∞has␈α∞some␈α∞condition␈α∞associated␈α∞with␈α∞it.␈α
 A
␈↓ ↓H␈↓time␈α∂constraint␈α∂for␈α∂the␈α∂entire␈α∂motion␈α∂is␈α∂also␈α∞given.␈α∂Note␈α∂that␈α∂the␈α∂word␈α∂VIA␈α∂must␈α∂be␈α∞repeated
␈↓ ↓H␈↓when conditions are specified for some intermediate point.

␈↓ ↓H␈↓One␈αfinal␈αfeature␈αis␈αavailable␈α
with␈αrespect␈αto␈αintermediate␈αpoints:␈α
One␈αmay␈αspecify␈αthat␈αa␈αpiece␈α
of
␈↓ ↓H␈↓code␈α∂is␈α∂to␈α∂be␈α∂initiated␈α⊂when␈α∂any␈α∂intermediate␈α∂point␈α∂is␈α⊂achieved.␈α∂ This␈α∂is␈α∂done␈α∂with␈α⊂a␈α∂THEN
␈↓ ↓H␈↓construct:

␈↓ ↓H␈↓        MOVE red TO rpark
␈↓ ↓H␈↓                VIA int1 THEN WRITE("Almost there!")
␈↓ ↓H␈↓                VIA int2 THEN ENABLE prepare_for_landing;
␈↓ ↓H␈↓2.2.6␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α∩MOTIONS␈↓ 
aPage 33



␈↓ ↓H␈↓The␈αstatement␈α
following␈αTHEN␈α
may␈αnot␈α
be␈αa␈αmotion␈α
statement␈αfor␈α
the␈αsame␈α
arm;␈αif␈αthe␈α
statement
␈↓ ↓H␈↓is␈α∀a␈α∀motion␈α∀statement,␈α∀it␈α∃must␈α∀be␈α∀surrounded␈α∀by␈α∀BEGIN␈α∃and␈α∀END.␈α∀ It␈α∀is␈α∀legal␈α∃to␈α∀have
␈↓ ↓H␈↓combinations␈α∂of␈α∂velocity,␈α⊂duration,␈α∂and␈α∂THEN-type␈α∂specifications␈α⊂all␈α∂at␈α∂the␈α⊂same␈α∂intermediate
␈↓ ↓H␈↓point.

␈↓ ↓H␈↓DIRECTLY␈αis␈αa␈αclause␈αthat␈αtells␈αthe␈αcompiler␈αthat␈αonly␈αthe␈αvia␈αpoints␈αand␈αthe␈αfinal␈αpoint␈αare␈αof
␈↓ ↓H␈↓interest;␈α⊃no␈α⊃smooth␈α⊂trajectory␈α⊃need␈α⊃be␈α⊃planned.␈α⊂ A␈α⊃smooth␈α⊃motion␈α⊂will␈α⊃result␈α⊃due␈α⊃to␈α⊂runtime
␈↓ ↓H␈↓calculations.  This will also set the deproaches to NILDEPROACH.

␈↓ ↓H␈↓TRACING␈α
is␈αanother␈α
option.␈α It␈α
allows␈α
the␈αuser␈α
greater␈αcontrol␈α
over␈αthe␈α
exact␈α
trajectory␈αchosen
␈↓ ↓H␈↓for␈α∞the␈α∞move.␈α∞ The␈α∞path␈α
can␈α∞be␈α∞traced␈α∞at␈α∞whatever␈α
speed␈α∞desired.␈α∞ The␈α∞path,␈α∞or␈α
␈↓βparameterized
␈↓ ↓H␈↓βframe␈↓,␈αis␈αa␈αspecification␈αof␈αwhat␈αframe␈αthe␈αarm␈αis␈αto␈αgo␈αthrough␈αfor␈αeach␈αvalue␈αof␈αthe␈αparameter.
␈↓ ↓H␈↓It␈αis␈αalso␈αpossible␈αto␈αspecify␈αthe␈αrelation␈αbetween␈αthe␈αparameter␈αand␈αreal␈αtime,␈αas␈αwell␈αas␈αthe␈αstate
␈↓ ↓H␈↓the␈α∞grain␈α∞of␈α∞the␈α∞motion␈α
(that␈α∞is,␈α∞how␈α∞often␈α∞the␈α
actual␈α∞location␈α∞should␈α∞coincide␈α∞exactly␈α∞with␈α
the
␈↓ ↓H␈↓parameterized␈α
frame)␈α
or␈α
the␈α∞acceptable␈α
tolerance␈α
(by␈α
a␈α∞distance␈α
scalar).␈α
A␈α
glorious␈α∞and␈α
complete
␈↓ ↓H␈↓example:

␈↓ ↓H␈↓        ANGLE SCALAR alpha;
␈↓ ↓H␈↓        FRAME center;
␈↓ ↓H␈↓        :
␈↓ ↓H␈↓        MOVE yellow  {␈↓βNo destination specified with a tracing motion.␈↓}
␈↓ ↓H␈↓                TRACING center + 12*VECTOR(COS(alpha),SIN(alpha),0)
␈↓ ↓H␈↓                FOR alpha ← 0 BY 10*DEG UNTIL 360*DEG
␈↓ ↓H␈↓                WITHIN .1*CM  {␈↓βThis is the tolerance.␈↓}
␈↓ ↓H␈↓                WITH DURATION = 10*SEC;

␈↓ ↓H␈↓This␈αspecifies␈αa␈αcircular␈αmotion␈αof␈αradius␈αtwelve␈αcentimeters␈αparallel␈αto␈αthe␈αsurface␈αof␈αthe␈αstation,
␈↓ ↓H␈↓about␈α∂the␈α∂frame␈α∂␈↓βcenter␈↓.␈α∞ Every␈α∂10␈α∂degrees,␈α∂the␈α∞arm␈α∂should␈α∂actually␈α∂be␈α∞in␈α∂the␈α∂right␈α∂place,␈α∞and,
␈↓ ↓H␈↓furthermore,␈α
it␈α
should␈α
never␈αbe␈α
more␈α
than␈α
.1␈α
centimeter␈α(pretty␈α
tight␈α
tolerance,␈α
actually;␈αmost␈α
likely
␈↓ ↓H␈↓beyond the capability of the manipulator) from the perfect circle.

␈↓ ↓H␈↓The␈α
option␈α∞MAINTAINING␈α
ORIENTATION␈α
causes␈α∞the␈α
trajectory␈α
computed␈α∞by␈α
'AL␈α
to␈α∞try␈α
to
␈↓ ↓H␈↓maintain␈αthe␈αsame␈αhand␈αorientation␈αthroughout␈α
the␈αmotion.␈α Of␈αcourse,␈αthe␈αfinal␈αorientation␈α
must
␈↓ ↓H␈↓be the same as the initial orientation for this to work at all.



␈↓ ↓H␈↓␈↓β2.2.7 COMPLEX MOVES␈↓

␈↓ ↓H␈↓A␈αcomplex␈αmove␈αis␈αone␈αwhich␈αinvolves␈αmore␈αthan␈αone␈αarm␈αat␈αa␈αtime.␈α A␈αdistinction␈αcan␈αbe␈αmade
␈↓ ↓H␈↓between␈α∞moves␈α∞which␈α∞merely␈α∞require␈α∞simultaneous␈α∞acquisition␈α∞of␈α∞"agreement␈α∞points"␈α∞(let␈α∂us␈α∞call
␈↓ ↓H␈↓this␈α∪weak␈α∀synchrony),␈α∪and␈α∪those␈α∀which␈α∪require␈α∪true␈α∀coordinated␈α∪motion␈α∀throughout␈α∪(strong
␈↓ ↓H␈↓synchrony).

␈↓ ↓H␈↓Weak␈α
synchrony␈α
is␈α
achieved␈α
by␈α
pairing␈α
frames␈α
to␈α
make␈α
composite␈α
VIA␈α
points␈α∞and␈α
destinations.
␈↓ ↓H␈↓A␈α
paired␈α
frame␈α
has␈α
the␈α
form:␈α
[F1␈α
:␈α∞F2].␈α
 Here␈α
is␈α
an␈α
example␈α
of␈α
a␈α
move␈α
statement␈α∞using␈α
paired
␈↓ ↓H␈↓frames:
␈↓ ↓H␈↓Page 34␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α9MOTIONS␈↓ ∂2.2.7



␈↓ ↓H␈↓        FRAME y1, y2, y3, y4, b1, b2, b3;
␈↓ ↓H␈↓        :
␈↓ ↓H␈↓        MOVE [yellow : blue]
␈↓ ↓H␈↓                VIA [y1:b1],[y2:],[y3:b2]
␈↓ ↓H␈↓                TO [y4:b3]
␈↓ ↓H␈↓                ON [FORCE(Z)>3000*DYNES:] DO STOP

␈↓ ↓H␈↓The␈αvia␈α
list␈αis␈αcomposed␈α
of␈αa␈α
set␈αof␈αpaired␈α
frames,␈αwhere␈α
an␈αempty␈αfield␈α
indicates␈α"don't␈αcare".␈α
 In
␈↓ ↓H␈↓the␈α∂example␈α∂shown,␈α∞the␈α∂arms␈α∂start␈α∂together,␈α∞achieve␈α∂y1␈α∂and␈α∞b1␈α∂simultaneously,␈α∂the␈α∂yellow␈α∞arm
␈↓ ↓H␈↓passes through y2, and together they pass through y3 and b2.

␈↓ ↓H␈↓It␈αis␈αnow␈αmore␈αcumbersome␈αto␈α
specify␈αcondition␈αmonitors␈αand␈αconditions␈αin␈αgeneral.␈α
 The␈αpaired
␈↓ ↓H␈↓construct applies for all the optional fields; thus, one can write

␈↓ ↓H␈↓        WITH FORCE = [14000*DYNES:] ALONG [X OF yellow:]


␈↓ ↓H␈↓The␈αmeanings␈αof␈α⊗␈αand␈α@␈αare␈αnow␈αrelative␈αto␈αwhich␈αside␈αof␈αthe␈αpair␈αthey␈αoccupy;␈αin␈αthe␈αexample
␈↓ ↓H␈↓above,␈α
the␈αleft␈α
side␈α
always␈αrefers␈α
to␈αthe␈α
yellow␈α
arm,␈αand␈α
the␈αright␈α
side␈α
to␈αthe␈α
blue.␈α
 To␈αoverride
␈↓ ↓H␈↓this convention, one may use expressions like "@.yellow", or "⊗.blue".

␈↓ ↓H␈↓The␈α
meaning␈α
of␈α
STOP␈α
in␈α
the␈α
example␈α
above␈α
is␈α
extended␈α
to␈α
both␈α
arms␈α
at␈α
once;␈α
in␈α
order␈α
to␈α
specify
␈↓ ↓H␈↓only one, it is necessary to say "STOP yellow" or "STOP blue".

␈↓ ↓H␈↓Strong␈αsynchrony␈αinvolves␈α
one␈αconcept␈αnot␈α
included␈αabove:␈αThe␈αability␈α
to␈αspecify␈αthe␈α
location␈αof
␈↓ ↓H␈↓one␈α
arm␈α
throughout␈αthe␈α
motion␈α
in␈αterms␈α
of␈α
the␈αlocation␈α
of␈α
the␈αother␈α
arm.␈α
 The␈α
construct␈αwhich
␈↓ ↓H␈↓allows␈αthis␈α
specification␈αis␈α
COORDINATING;␈αit␈αallows␈α
one␈αto␈α
give␈αan␈α
expression␈αfor␈αthe␈α
location
␈↓ ↓H␈↓of␈α
one␈αof␈α
the␈αtwo␈α
arms.␈α Suppose␈α
we␈αwish␈α
to␈αkeep␈α
both␈αarms␈α
in␈α"lockstep",␈α
that␈αis,␈α
the␈α
blue␈αarm
␈↓ ↓H␈↓should␈α⊃retain␈α⊂its␈α⊃relative␈α⊃position␈α⊂to␈α⊃the␈α⊃yellow␈α⊂arm␈α⊃throughout␈α⊃the␈α⊂motion.␈α⊃ (This␈α⊃might␈α⊂be
␈↓ ↓H␈↓necessary for lifting some object by its two ends.) One way to code this task is as follows:

␈↓ ↓H␈↓        FRAME y1, yint1, yint2;
␈↓ ↓H␈↓        MOVE [yellow : blue]
␈↓ ↓H␈↓                TO [y1:]
␈↓ ↓H␈↓                VIA [yint1:],[yint2:]
␈↓ ↓H␈↓                COORDINATING LOC(blue) = LOC(yellow) + ⊗.blue - ⊗.yellow
␈↓ ↓H␈↓                WITH FORCE = [:0] ALONG [: X,Y OF blue]
␈↓ ↓H␈↓                [MAINTAINING ORIENT : MAINTAINING ORIENT]




␈↓ ↓H␈↓␈↓β2.2.8 SEARCHES␈↓

␈↓ ↓H␈↓A␈αSEARCH␈α
is␈αvery␈α
much␈αlike␈α
a␈αmove.␈α
 It␈αis␈α
a␈αmeans␈α
of␈αspecifying␈α
repeated␈αaction␈α
in␈αa␈αspiral.␈α
 As
␈↓ ↓H␈↓with␈α∂a␈α∂MOVE,␈α∂it␈α∂is␈α∂necessary␈α∂to␈α∂name␈α∂a␈α∂controllable␈α∂frame␈α∂which␈α∂is␈α∂to␈α∂be␈α∂moved.␈α⊂ The␈α∂ON
␈↓ ↓H␈↓construct is exactly as for MOVEs.
␈↓ ↓H␈↓2.2.8␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α∩MOTIONS␈↓ 
aPage 35



␈↓ ↓H␈↓Here is a complete example of a search:

␈↓ ↓H␈↓        PLANE p1;
␈↓ ↓H␈↓        :
␈↓ ↓H␈↓        SEARCH yellow
␈↓ ↓H␈↓                ACROSS p1
␈↓ ↓H␈↓                WITH INCREMENT = 3*CM
␈↓ ↓H␈↓                REPEATING
␈↓ ↓H␈↓                        BEGIN  {␈↓βThis is done at each iteration␈↓}
␈↓ ↓H␈↓                        FRAME set;
␈↓ ↓H␈↓                        set ← yellow;
␈↓ ↓H␈↓                        MOVE yellow TO ⊗ - Z
␈↓ ↓H␈↓                                ON FORCE(Z) > 3000*DYNES DO TERMINATE;
␈↓ ↓H␈↓                        MOVE yellow TO set DIRECTLY;
␈↓ ↓H␈↓                        END

␈↓ ↓H␈↓The␈α⊂plane␈α∂of␈α⊂the␈α⊂search␈α∂is␈α⊂specified␈α⊂by␈α∂the␈α⊂ACROSS␈α∂construct.␈α⊂ A␈α⊂spiral␈α∂box␈α⊂search␈α⊂will␈α∂be
␈↓ ↓H␈↓performed␈α
in␈α
this␈α
plane␈α(or␈α
parallel␈α
to␈α
it,␈α
it␈αthe␈α
initial␈α
location␈α
of␈α
the␈αhand␈α
is␈α
not␈α
in␈α
the␈αplane);␈α
the
␈↓ ↓H␈↓increment␈α∂for␈α∂the␈α∂search␈α∂will␈α∂be␈α∂three␈α⊂centimeters.␈α∂ At␈α∂each␈α∂point␈α∂in␈α∂the␈α∂search,␈α⊂the␈α∂statement
␈↓ ↓H␈↓following␈α
REPEATING␈α
is␈α
executed;␈α
in␈α
this␈α
case,␈α
that␈α
involves␈α
two␈α
motions.␈α
 The␈α
special␈α
statement
␈↓ ↓H␈↓TERMINATE␈α∞causes␈α∞the␈α
search␈α∞to␈α∞finally␈α∞succeed;␈α
if␈α∞there␈α∞is␈α∞an␈α
ON␈α∞ARRIVAL␈α∞clause␈α∞in␈α
the
␈↓ ↓H␈↓search,␈αit␈αwill␈αtrigger␈α
when␈αTERMINATE␈αis␈αexecuted.␈α
 It␈αis␈αalso␈αpossible␈α
to␈αterminate␈αa␈αsearch␈α
by
␈↓ ↓H␈↓setting␈α
some␈αflag␈α
inside␈αthe␈α
repeated␈αcode,␈α
and␈αto␈α
test␈αit␈α
in␈αa␈α
condition␈αmonitor␈α
associated␈αwith␈α
the
␈↓ ↓H␈↓search.␈α That␈α
monitor␈αcan␈αexecute␈α
the␈αstatement␈αSTOP,␈α
causing␈αthe␈αsearch␈α
to␈αbe␈αhalted.␈α
 In␈αthis
␈↓ ↓H␈↓case, any test for ARRIVAL will never trigger.



␈↓ ↓H␈↓␈↓β2.2.9 CENTER␈↓

␈↓ ↓H␈↓Occasionally␈αthe␈αhand␈αis␈αpositioned␈αaround␈αan␈αobject,␈α
but␈αit␈αis␈αnot␈αcertain␈αif␈αit␈αis␈α
centered.␈α One
␈↓ ↓H␈↓wants␈αto␈αclose␈αthe␈αfingers␈αslowly,␈αmoving␈αthe␈αarm␈αmeanwhile␈αto␈αaccomodate␈αto␈αthe␈αlocation␈αof␈αthe
␈↓ ↓H␈↓object.␈α This␈αis␈αaccomplished␈αby␈αmeans␈αof␈αthe␈αCENTER␈αcommand.␈α The␈αdirection␈αthat␈αthe␈αhand
␈↓ ↓H␈↓will␈αmove␈αis␈αthe␈α
direction␈αbetween␈αits␈αfingers.␈α
 All␈αthat␈αthe␈αCENTER␈α
command␈αneeds␈αis␈αthe␈α
name
␈↓ ↓H␈↓of the arm being moved.  The use of ON is the same as for a search or any other motion.

␈↓ ↓H␈↓Here is a simple example:

␈↓ ↓H␈↓        CENTER blue
␈↓ ↓H␈↓                ON SQUEEZE > 4 DO STOP

␈↓ ↓H␈↓Note that this is command, unlike MOVE, treats the fingers and the arm together as one device.
␈↓ ↓H␈↓Page 36␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α9MOTIONS␈↓ 2.2.10



␈↓ ↓H␈↓␈↓β2.2.10 CONSTANT VELOCITY MOTION␈↓

␈↓ ↓H␈↓A␈α⊂special␈α⊂form␈α⊂of␈α⊂the␈α⊃MOVE␈α⊂instruction␈α⊂is␈α⊂provided␈α⊂to␈α⊃cause␈α⊂the␈α⊂arm␈α⊂to␈α⊂quickly␈α⊃achieve␈α⊂a
␈↓ ↓H␈↓particular velocity and to hold it in straight-line motion for a given distance:

␈↓ ↓H␈↓        VELOCITY VECTOR vv1;
␈↓ ↓H␈↓        VECTOR v1;
␈↓ ↓H␈↓        FRAME dest;
␈↓ ↓H␈↓        :
␈↓ ↓H␈↓        MOVE yellow
␈↓ ↓H␈↓                WITH VELOCITY = vv1
␈↓ ↓H␈↓                        THROUGH dest
␈↓ ↓H␈↓                        FOR DISTANCE = 4*CM             .
␈↓ ↓H␈↓                ON FORCE(v1) > 2000*DYNES DO STOP

␈↓ ↓H␈↓The␈αVELOCITY␈αclause␈αtells␈αwhich␈αvector␈αto␈αfollow,␈αand␈αhow␈αfast.␈αThe␈αTHROUGH␈αclause␈αtells
␈↓ ↓H␈↓the␈αcompiler␈αwhere␈αthe␈α
move␈αexpects␈αto␈αend.␈αThe␈α
FOR␈αDISTANCE␈αtells␈αthe␈α
maximum␈αdistance
␈↓ ↓H␈↓the hand should go. It is general practice to terminate such a move by use of a condition monitor.



␈↓ ↓H␈↓␈↓β2.2.11 STOPPING␈↓

␈↓ ↓H␈↓Generally,␈αan␈αarm␈αwill␈αstop␈αits␈αmotion␈αwhen␈αit␈αhas␈αachieved␈αits␈αdestination.␈α Often␈αit␈αis␈αnecessary
␈↓ ↓H␈↓to stop it prematurely, for example, if some error condition is detected.  The statement

␈↓ ↓H␈↓        STOP yellow

␈↓ ↓H␈↓causes␈α∩the␈α∩yellow␈α∩arm␈α∩to␈α∩be␈α⊃unconditionally␈α∩stopped;␈α∩any␈α∩motion␈α∩statement␈α∩operating␈α∩it␈α⊃will
␈↓ ↓H␈↓terminate.␈α This␈αstatement␈αmay␈αbe␈αexecuted␈αat␈αany␈αpoint␈αin␈αthe␈αprogram,␈αnot␈αjust␈αinside␈αa␈αmotion
␈↓ ↓H␈↓statement.



␈↓ ↓H␈↓␈↓β2.2.12 DEVICE CONTROL␈↓

␈↓ ↓H␈↓Each␈αdevice␈αhas␈αa␈αname;␈αcurrently,␈αthe␈αlegal␈αdevice␈αnames␈αare␈α␈↓βyellow,␈αblue,␈αvice,␈αdriver␈↓␈α(an␈αelectric
␈↓ ↓H␈↓screwdriver),␈α␈↓βyfingers,␈αbfingers␈↓␈α(The␈αfingers␈αof␈αthe␈αtwo␈αarms).␈αSTOP␈αwithout␈αany␈αdevice␈αname␈αis
␈↓ ↓H␈↓only␈α⊃legal␈α⊃within␈α⊃a␈α⊂motion␈α⊃command;␈α⊃it␈α⊃stops␈α⊂whatever␈α⊃device(s)␈α⊃that␈α⊃command␈α⊃is␈α⊂operating.
␈↓ ↓H␈↓STOP followed by a device name will unconditionally stop that device.

␈↓ ↓H␈↓There␈αis␈α
a␈αgeneral␈α
command␈αfor␈αoperating␈α
devices␈αother␈α
than␈αarms;␈αit␈α
is␈αhoped␈α
that␈αthis␈α
will␈αbe
␈↓ ↓H␈↓flexible␈α
enough␈α
for␈α
any␈α
device␈α
we␈α
are␈α
likely␈α
to␈α
use␈α
(if␈α
not,␈α
we␈α
will␈α
add␈α
special␈α
new␈α
forms).␈α
 Assume
␈↓ ↓H␈↓we␈α
have␈α
the␈α
device␈α
␈↓βturntable␈↓,␈αwhich␈α
is␈α
capable␈α
of␈α
moving␈α
at␈αany␈α
velocity␈α
and␈α
for␈α
any␈α
length␈αof
␈↓ ↓H␈↓time, but which cannot go to a particular set point.  Then the syntax would be this:

␈↓ ↓H␈↓        OPERATE turntable
␈↓ ↓H␈↓                WITH VELOCITY = 3*DEG/SEC
␈↓ ↓H␈↓                WITH DURATION = 8*SEC
␈↓ ↓H␈↓2.2.12␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α
MOTIONS␈↓ 
aPage 37



␈↓ ↓H␈↓The␈α∞idea␈α∞is␈α∞that␈α∂the␈α∞WITH␈α∞construct␈α∞will␈α∂suffice␈α∞to␈α∞account␈α∞for␈α∂any␈α∞special␈α∞data␈α∞(in␈α∂this␈α∞case,
␈↓ ↓H␈↓velocity␈α
and␈α
duration)␈α
peculiar␈α
to␈α
the␈α
particular␈α
device.␈α
 The␈α
OPERATE␈α
statement␈α
also␈α
allows␈α
the
␈↓ ↓H␈↓ON␈α∂construct,␈α∂so␈α∂it␈α⊂can␈α∂test␈α∂for␈α∂special␈α∂conditions␈α⊂and␈α∂take␈α∂appropriate␈α∂actions;␈α∂it␈α⊂also␈α∂always
␈↓ ↓H␈↓allows WITH DURATION.

␈↓ ↓H␈↓The␈αscrewdriver␈αis␈α
a␈αhand-held␈αdevice␈α
which␈αcan␈αbe␈αrun␈α
at␈αa␈αrange␈α
of␈αspeeds,␈αin␈αeither␈α
direction.
␈↓ ↓H␈↓By␈α
convention,␈α∞a␈α
positive␈α
velocity␈α∞means␈α
clockwise,␈α
and␈α∞a␈α
negative␈α
velocity␈α∞means␈α
anticlockwise.
␈↓ ↓H␈↓The␈αrelevant␈αreserved␈αword␈αis␈αVELOCITY,␈αwhich␈αis␈αequated␈αwith␈αthe␈αname␈αof␈αa␈αscalar␈αvariable
␈↓ ↓H␈↓of␈α∪dimension␈α∪␈↓βangle/time␈↓.␈α∪ This␈α∪variable␈α∪will␈α∪be␈α∪queried␈α∪periodically␈α∪during␈α∪the␈α∩screwdriver
␈↓ ↓H␈↓motion␈αto␈αdetermine␈αhow␈αmuch␈αvoltage␈αto␈αapply␈αto␈αthe␈αmotor.␈α This␈αallows␈αthe␈αvelocity␈αto␈αchange
␈↓ ↓H␈↓during␈α⊂the␈α⊃operation␈α⊂of␈α⊂the␈α⊃device,␈α⊂perhaps␈α⊂under␈α⊃the␈α⊂control␈α⊂of␈α⊃a␈α⊂parallel␈α⊂process␈α⊃which␈α⊂is
␈↓ ↓H␈↓monitoring some conditions.  An example:

␈↓ ↓H␈↓        OPERATE driver
␈↓ ↓H␈↓                WITH VELOCITY = sp
␈↓ ↓H␈↓                WITH DURATION = 4*SEC
␈↓ ↓H␈↓                ON DURATION>2*SEC DO sp ← 2*sp
␈↓ ↓H␈↓␈↓ βH␈↓β{After two seconds, speed up the screwdriver.}


␈↓ ↓H␈↓Each␈αarm␈αhas␈αtwo␈αfingers␈αat␈αthe␈αend␈αwhich␈αare␈αcapable␈αof␈αclosing␈αand␈αopening␈αat␈αvarious␈αspeeds.
␈↓ ↓H␈↓The␈α∞relevant␈α∞reserved␈α∞words␈α∞are␈α∞OPENING,␈α∞which␈α
is␈α∞to␈α∞be␈α∞set␈α∞to␈α∞the␈α∞desired␈α∞(distance␈α
scalar)
␈↓ ↓H␈↓opening,␈αand␈αVELOCITY,␈αwhich␈αis␈αto␈αbe␈αset␈αto␈αthe␈α(velocity␈αscalar)␈αspeed␈αdesired.␈α It␈αis␈αpossible
␈↓ ↓H␈↓to␈α∞refer␈α∞to␈α∞the␈α∞force␈α∞scalar␈α∞variable␈α
SQUEEZE,␈α∞which␈α∞indicates␈α∞the␈α∞force␈α∞being␈α∞applied␈α∞by␈α
the
␈↓ ↓H␈↓fingers.␈α Condition␈αmonitors␈αcan␈αalso␈αmake␈αuse␈αof␈αthe␈αdistance␈αscalar␈αvariable␈α
OPENING␈αwhich
␈↓ ↓H␈↓will continually reflect the distance between the fingers.  An example:

␈↓ ↓H␈↓        OPERATE yfingers
␈↓ ↓H␈↓                WITH OPENING = 2*IN
␈↓ ↓H␈↓                WITH VELOCITY = 2*CM/SEC
␈↓ ↓H␈↓                ON SQUEEZE > 3*OZ DO STOP
␈↓ ↓H␈↓                ON OPENING ≤ 1*CM DO STOP






␈↓ ↓H␈↓␈↓∧2.3 AFFIXMENT␈↓



␈↓ ↓H␈↓␈↓β2.3.1 THE AFFIX STATEMENT␈↓

␈↓ ↓H␈↓Assembly␈α∞often␈α∞involves␈α∞affixing␈α
one␈α∞object␈α∞to␈α∞another.␈α
 'AL␈α∞has␈α∞a␈α∞mechanism␈α∞to␈α
automatically
␈↓ ↓H␈↓keep␈α∩track␈α∪of␈α∩the␈α∩location␈α∪of␈α∩a␈α∩subsidiary␈α∪piece␈α∩of␈α∩the␈α∪assembly␈α∩as␈α∩its␈α∪base␈α∩is␈α∪moved;␈α∩the
␈↓ ↓H␈↓mechanism␈α
is␈α
called␈α∞␈↓βaffixment␈↓.␈α
 For␈α
example,␈α
there␈α∞might␈α
be␈α
a␈α
frame␈α∞called␈α
pump␈α
and␈α∞a␈α
frame
␈↓ ↓H␈↓called␈α∞base.␈α∞ At␈α∂some␈α∞stage␈α∞in␈α∂the␈α∞assembly,␈α∞the␈α∂pump␈α∞is␈α∞bolted␈α∂to␈α∞the␈α∞base.␈α∂ At␈α∞this␈α∞time␈α∂it␈α∞is
␈↓ ↓H␈↓appropriate to include the statement
␈↓ ↓H␈↓Page 38␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α(AFFIXMENT␈↓ ∂2.3.1



␈↓ ↓H␈↓        AFFIX pump TO base      .

␈↓ ↓H␈↓This␈α
statement␈α
informs␈α
the␈α
compiler␈α
that␈α
motions␈αof␈α
base␈α
are␈α
to␈α
affect␈α
the␈α
location␈α
of␈αpump␈α
causes
␈↓ ↓H␈↓code␈α∞to␈α
be␈α∞generated␈α∞for␈α
the␈α∞runtime␈α
which␈α∞will␈α∞automatically␈α
update␈α∞the␈α
value␈α∞of␈α∞pump␈α
every
␈↓ ↓H␈↓time␈α∞base␈α∞is␈α∞changed.␈α∞ Finally,␈α∞the␈α∞planning␈α∂model␈α∞will␈α∞be␈α∞updated␈α∞to␈α∞reflect␈α∞the␈α∂affixment.␈α∞ A
␈↓ ↓H␈↓slightly␈α
more␈α
formal␈α
definition␈α
of␈α
affixment,␈α∞in␈α
terms␈α
of␈α
explicit␈α
assertions␈α
and␈α∞modifications␈α
to
␈↓ ↓H␈↓the runtime graph structure, is given in subsection 2.4.2.

␈↓ ↓H␈↓Please␈α∂note␈α∞that␈α∂the␈α∞AFFIX␈α∂statement␈α∞does␈α∂not␈α∞act␈α∂as␈α∞a␈α∂library␈α∞routine␈α∂invocation;␈α∞it␈α∂does␈α∞not
␈↓ ↓H␈↓generate␈α∞code␈α
to␈α∞actually␈α∞perform␈α
the␈α∞bolting␈α
operation.␈α∞ The␈α∞statement␈α
merely␈α∞informs␈α∞the␈α
'AL
␈↓ ↓H␈↓system␈α∞that␈α∞at␈α∞this␈α∞stage␈α∂in␈α∞the␈α∞execution␈α∞of␈α∞the␈α∞program,␈α∂pump␈α∞is␈α∞to␈α∞be␈α∞considered␈α∂affixed␈α∞to
␈↓ ↓H␈↓base.

␈↓ ↓H␈↓If␈αpump␈αshould␈αbe␈αmoved␈αwhile␈αaffixed␈αto␈αbase,␈αthe␈αvalue␈αof␈αbase␈αitself␈αwill␈αnot␈αchange,␈αbut␈αthe
␈↓ ↓H␈↓affixment␈αwill␈αremain␈αfor␈αthe␈αnew␈αrelative␈αpositions␈αof␈αpump␈αand␈αbase.␈α Occasionally␈αit␈αis␈αdesired
␈↓ ↓H␈↓that␈α∂the␈α∂affixment␈α∂be␈α∂symmetric,␈α∂so␈α∂that␈α∂motion␈α∞of␈α∂either␈α∂frame␈α∂will␈α∂cause␈α∂the␈α∂other␈α∂to␈α∞move.
␈↓ ↓H␈↓This is done by including the reserved word RIGIDLY in the affix statement:

␈↓ ↓H␈↓        AFFIX pump TO base RIGIDLY

␈↓ ↓H␈↓The␈α∞system␈α∞uses␈α∞a␈α∞trans␈α∞to␈α∞store␈α∂the␈α∞relative␈α∞positions␈α∞(in␈α∞our␈α∞example,␈α∞(base → pump)␈α∞)␈α∂of␈α∞the
␈↓ ↓H␈↓affixed␈α⊃frames.␈α∩ Normally,␈α⊃the␈α⊃system␈α∩would␈α⊃invent␈α∩a␈α⊃temporary␈α⊃variable␈α∩to␈α⊃hold␈α∩this␈α⊃trans;
␈↓ ↓H␈↓however,␈αthe␈αuser␈αcan␈α
supply␈αhis␈αown␈αvariable␈α
to␈αbe␈αused␈αinstead,␈α
thus␈αallowing␈αhis␈αto␈αmodify␈α
the
␈↓ ↓H␈↓affixment␈αrelation␈αdirectly.␈α This␈αis␈αdone␈αby␈αincluding␈αthe␈αphrase␈α"BY <trans variable id>"␈αin␈αthe
␈↓ ↓H␈↓AFFIX statement.  For instance,

␈↓ ↓H␈↓        TRANS t1;
␈↓ ↓H␈↓        :
␈↓ ↓H␈↓        AFFIX pump TO base BY t1;

␈↓ ↓H␈↓If␈αthe␈αvalue␈αof␈α
the␈αtrans␈αis␈αmodified␈αin␈α
a␈αnon-rigid␈α(that␈αis,␈α
asymmetric)␈αaffixment,␈αthe␈αeffect␈αis␈α
to
␈↓ ↓H␈↓move␈α∞the␈α
subsidiary␈α∞frame.␈α∞ If␈α
the␈α∞value␈α
of␈α∞the␈α∞trans␈α
changes␈α∞in␈α
a␈α∞rigid␈α∞(symmetric)␈α
affixment,
␈↓ ↓H␈↓then␈αneither␈α
frame␈αwill␈αchange␈α
its␈αvalue␈α
until␈αone␈αof␈α
them␈αexplicitly␈α
gets␈αa␈αnew␈α
value;␈αat␈αthat␈α
time
␈↓ ↓H␈↓the other will spring to a new position, as determined by the trans.

␈↓ ↓H␈↓The␈αinclusion␈αof␈αthe␈αconstruct␈α"AT <trans expression>"␈α
will␈αcause␈α'AL␈αto␈αuse␈αthe␈α
indicated␈αvalue
␈↓ ↓H␈↓for the relative affixed position of the objects.  Thus,
␈↓ ↓H␈↓2.3.1␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α↓AFFIXMENT␈↓ 
aPage 39



␈↓ ↓H␈↓        AFFIX pump TO base AT NILTRANS

␈↓ ↓H␈↓is equivalent to

␈↓ ↓H␈↓        TRANS tempxf;
␈↓ ↓H␈↓        AFFIX pump TO base BY tempxf;
␈↓ ↓H␈↓        TEMPXF ← NILTRANS

␈↓ ↓H␈↓Similarly,

␈↓ ↓H␈↓        TRANS XF;
␈↓ ↓H␈↓        AFFIX pump TO base BY xf AT TRANS(NILROT,Z);
␈↓ ↓H␈↓is equivalent to

␈↓ ↓H␈↓        TRANS XF;
␈↓ ↓H␈↓        AFFIX pump TO base BY xf;
␈↓ ↓H␈↓        xf ← TRANS(NILROT,Z);

␈↓ ↓H␈↓It␈α∞is␈α∞possible␈α∞to␈α∞make␈α∞chains␈α∞of␈α∞affixments,␈α∞possibly␈α∞involving␈α∞some␈α∞rigid␈α∞affixments␈α∞and␈α∞some
␈↓ ↓H␈↓non-rigid ones.



␈↓ ↓H␈↓␈↓β2.3.2 THE UNFIX STATEMENT␈↓

␈↓ ↓H␈↓Affixments are undone by the UNFIX statement.  For example,

␈↓ ↓H␈↓        UNFIX pump FROM base

␈↓ ↓H␈↓will␈α⊃remove␈α⊂the␈α⊃affix␈α⊂structure␈α⊃between␈α⊃pump␈α⊂and␈α⊃base,␈α⊂and␈α⊃will␈α⊂discard␈α⊃the␈α⊃invented␈α⊂trans
␈↓ ↓H␈↓(unless␈α⊂it␈α⊂was␈α∂named,␈α⊂of␈α⊂course).␈α⊂ Similarly,␈α∂the␈α⊂compiler's␈α⊂planning␈α∂model␈α⊂will␈α⊂be␈α⊂updated␈α∂to
␈↓ ↓H␈↓reflect␈α⊂the␈α⊂fact␈α⊃that␈α⊂pump␈α⊂and␈α⊂base␈α⊃are␈α⊂no␈α⊂longer␈α⊂affixed.␈α⊃However,␈α⊂the␈α⊂fact␈α⊂that␈α⊃they␈α⊂were
␈↓ ↓H␈↓previously␈α⊃affixed␈α∩is␈α⊃important␈α∩for␈α⊃calculation␈α⊃of␈α∩default␈α⊃"deproaches"␈α∩(Section␈α⊃2.2.5),␈α∩and␈α⊃is
␈↓ ↓H␈↓remembered␈α⊗until␈α⊗either␈α⊗of␈α⊗the␈α⊗two␈α⊗frames␈α∃is␈α⊗changes.␈α⊗ See␈α⊗subsection␈α⊗2.4.2␈α⊗for␈α⊗a␈α∃more
␈↓ ↓H␈↓detailed description of the assertions actually made do do this.



␈↓ ↓H␈↓␈↓β2.3.3 MOTIONS AND AFFIXMENT␈↓

␈↓ ↓H␈↓When␈αsome␈αframe␈αhas␈α
been␈αaffixed␈αto␈αan␈α
arm,␈αit␈αcan␈αbe␈α
treated␈αas␈αif␈αit␈α
were␈αitself␈αan␈αarm.␈α
 Thus,
␈↓ ↓H␈↓the following is legal and useful:

␈↓ ↓H␈↓        FRAME frob, frobgrasp;
␈↓ ↓H␈↓        :
␈↓ ↓H␈↓        AFFIX frobgrasp TO frob;
␈↓ ↓H␈↓        AFFIX frob TO yellow;
␈↓ ↓H␈↓        :
␈↓ ↓H␈↓        MOVE frobgrasp TO ⊗ + (Z WRT frob);
␈↓ ↓H␈↓Page 40␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α(AFFIXMENT␈↓ ∂2.3.3



␈↓ ↓H␈↓The␈α⊃effect␈α⊃of␈α⊂this␈α⊃motion␈α⊃statement␈α⊂is␈α⊃to␈α⊃cause␈α⊂the␈α⊃yellow␈α⊃arm␈α⊂to␈α⊃move␈α⊃in␈α⊂such␈α⊃a␈α⊃way␈α⊂that
␈↓ ↓H␈↓frobgrasp␈α⊂moves␈α⊂one␈α⊂centimeter␈α⊂in␈α⊂frob's␈α⊂Z␈α⊂direction.␈α⊂ The␈α⊂compiler␈α⊂notices␈α⊂that␈α⊂frobgrasp␈α⊂is
␈↓ ↓H␈↓affixed␈αto␈αfrob,␈αwhich␈αin␈αturn␈αis␈αaffixed␈αto␈αyellow;␈αfurthermore,␈αit␈αknows␈αthe␈αrelative␈αpositions␈αof
␈↓ ↓H␈↓each␈α
of␈αthese,␈α
so␈αit␈α
is␈αnot␈α
too␈αhard␈α
to␈α
translate␈αthe␈α
given␈αmotion␈α
statement␈αinto␈α
a␈αstatement␈α
dealing
␈↓ ↓H␈↓only␈αwith␈αthe␈αyellow␈αarm.␈α It␈αis␈αa␈αgreat␈αconvenience␈αto␈αlet␈αthe␈αcompiler␈αdo␈αthis␈α
translation,␈αwhich
␈↓ ↓H␈↓can get messy in the presence of complicated affixment structures.

␈↓ ↓H␈↓The␈αuse␈αof␈α"⊗"␈αinside␈αa␈αmotion␈αalways␈αrefers␈α
to␈αthe␈αframe␈αbeing␈αtreated␈αas␈αan␈αarm,␈αwhether␈α
it␈αis
␈↓ ↓H␈↓actually an arm (blue, yellow) or an affixed frame (frobgrasp).

␈↓ ↓H␈↓If␈α
some␈α
frame␈α
is␈α
attached␈α
to␈α
more␈α
than␈α
one␈αarm,␈α
then␈α
it␈α
is␈α
not␈α
legal␈α
to␈α
use␈α
this␈α
feature,␈αbecause␈α
the
␈↓ ↓H␈↓compiler␈αwould␈αhave␈αno␈αway␈αof␈αdetermining␈αwhich␈αarm␈αto␈αuse.␈α Actually,␈αsuch␈αan␈αattempt␈αis␈αmost
␈↓ ↓H␈↓likely␈α⊂an␈α⊂error␈α⊂on␈α⊂the␈α⊂user's␈α⊂part;␈α⊂if␈α⊂an␈α⊂object␈α⊂is␈α⊂affixed␈α⊂to␈α⊂both␈α⊂arms,␈α⊂then␈α⊂they␈α⊃are␈α⊂joined
␈↓ ↓H␈↓through␈α∞that␈α∂object.␈α∞ It␈α∞is␈α∂therefore␈α∞not␈α∞safe␈α∂to␈α∞move␈α∞one␈α∂arm␈α∞and␈α∞not␈α∂the␈α∞other.␈α∂ The␈α∞"right"
␈↓ ↓H␈↓thing␈αto␈αdo␈αin␈αsuch␈αa␈αcase␈αwould␈αbe␈αmove␈αall␈αthe␈αrelevant␈αarms␈αto␈αthe␈αappropriate␈αplaces.␈α We␈αdo
␈↓ ↓H␈↓not intend to implement this at first.





␈↓ ↓H␈↓␈↓∧2.4 GRAPH STRUCTURES␈↓

␈↓ ↓H␈↓Affixments␈αare␈αstored␈αin␈αboth␈αthe␈αcompiler␈αand␈αthe␈αruntime␈αby␈αmeans␈αof␈αa␈α␈↓βgraph␈αstructure␈↓␈α
which
␈↓ ↓H␈↓is␈α∞used␈α∞to␈α∞assure␈α
that␈α∞variable␈α∞values␈α∞are␈α∞consistently␈α
updated.␈α∞ The␈α∞actual␈α∞algorithms␈α∞used␈α
for
␈↓ ↓H␈↓this␈α↔process␈α↔are␈α_given␈α↔in␈α↔Appendix␈α_III.␈α↔ Essentially,␈α↔the␈α_runtime␈α↔system␈α↔keeps␈α_track␈α↔of
␈↓ ↓H␈↓dependencies␈α
between␈α
variables.␈α If␈α
a␈α
variable␈αvalue␈α
is␈α
changed,␈α
any␈αvariables␈α
which␈α
depend␈αon␈α
it
␈↓ ↓H␈↓are␈α⊃marked␈α⊃as␈α∩"invalid".␈α⊃ Then,␈α⊃whenever␈α∩the␈α⊃value␈α⊃of␈α⊃an␈α∩"invalid"␈α⊃variable␈α⊃is␈α∩needed,␈α⊃the
␈↓ ↓H␈↓runtime␈α
system␈α
will␈α
attempt␈α
to␈α
recompute␈α
it␈α
from␈α
the␈α
dependency␈α
information.␈α
 If␈α
this␈αattempt␈α
fails
␈↓ ↓H␈↓(as␈α∞might␈α∞happen␈α∞if␈α∞two␈α∞"invalid"␈α∞variables␈α∞depend␈α∞on␈α∞each␈α∞other)␈α∞then␈α∞the␈α∞current␈α∞("invalid")
␈↓ ↓H␈↓value is used as the best answer available.



␈↓ ↓H␈↓␈↓β2.4.1 EXPLICIT MODIFICATIONS TO THE GRAPH STRUCTURE␈↓

␈↓ ↓H␈↓The␈α∞dependency␈α
information␈α∞principally␈α
consists␈α∞of␈α
a␈α∞list␈α
of␈α∞arithmetic␈α
expressions␈α∞that␈α∞may␈α
be
␈↓ ↓H␈↓used␈α∩to␈α∩calculate␈α∩the␈α∩new␈α∩value␈α∩of␈α∩a␈α∩variable,␈α∩together␈α∩with␈α∩a␈α∩list␈α∩of␈α∩statements␈α∩to␈α⊃execute
␈↓ ↓H␈↓whenever␈αthe␈αvariable␈αis␈αchanged.␈α (In␈αaddition,␈αthe␈αruntime␈αkeeps␈αwith␈αeach␈αvariable␈αa␈αlist␈αof␈α
all
␈↓ ↓H␈↓other␈α
variables␈αwhose␈α
values␈αmay␈α
depend␈αupon␈α
that␈αvariable).␈α
 Generally,␈αthis␈α
information␈αwill␈α
be
␈↓ ↓H␈↓updated␈α⊃implicitly␈α⊃as␈α⊃part␈α⊃of␈α⊃the␈α⊃AFFIX␈α⊃&␈α⊃UNFIX␈α⊃statements.␈α⊃ However,␈α⊃'AL␈α⊃does␈α⊃provide
␈↓ ↓H␈↓statements␈α∀for␈α∪updating␈α∀the␈α∪structure␈α∀explicitly.␈α∪ The␈α∀principal␈α∪statement␈α∀employed␈α∀for␈α∪this
␈↓ ↓H␈↓purpose is the ␈↓βgraph assignment statement␈↓:

␈↓ ↓H␈↓        <variable> <= <expression>

␈↓ ↓H␈↓where␈α"<="␈αmay␈αbe␈αread␈α"is␈αcomputed␈αby".␈α This␈αconstruct␈αcauses␈α<expression>␈αto␈αbe␈αadded␈αto␈αthe
␈↓ ↓H␈↓list␈αof␈αcalculators␈αfor␈α<variable>.␈α Also,␈αit␈αcauses␈αthe␈αleft␈αhand␈αside␈α<variable>␈αto␈αbe␈αadded␈αto␈αthe
␈↓ ↓H␈↓dependents list of any variables that may occur in the <expression>.  Thus,
␈↓ ↓H␈↓2.4.1␈α?␈α?␈α?␈α?␈α?␈α?␈α5GRAPH STRUCTURES␈↓ 
aPage 41



␈↓ ↓H␈↓        FRAME f1, f2;
␈↓ ↓H␈↓        TRANS t;
␈↓ ↓H␈↓        f1 <= t*f2;

␈↓ ↓H␈↓says␈α∂that␈α∂f1␈α∞is␈α∂computed␈α∂by␈α∞the␈α∂expression␈α∂"t*f2"␈α∂and,␈α∞hence,␈α∂depends␈α∂on␈α∞t␈α∂and␈α∂f2.␈α∂ Note␈α∞that
␈↓ ↓H␈↓graph assignment is cumulative, so that

␈↓ ↓H␈↓        a <= b*c;
␈↓ ↓H␈↓        a <= d+e;

␈↓ ↓H␈↓would␈α∂cause␈α⊂a␈α∂to␈α⊂be␈α∂marked␈α⊂invalid␈α∂whenever␈α⊂b,␈α∂c,␈α∂d,␈α⊂or␈α∂e␈α⊂is␈α∂changed.␈α⊂ In␈α∂such␈α⊂a␈α∂case,␈α⊂it␈α∂is
␈↓ ↓H␈↓undefined␈α
whether␈α
"b*c"␈α
or␈α
"d+e"␈αwould␈α
be␈α
used␈α
to␈α
recompute␈αa,␈α
assuming␈α
that␈α
all␈α
of␈αthe␈α
variables
␈↓ ↓H␈↓were valid when the value of a is needed.

␈↓ ↓H␈↓The statement

␈↓ ↓H␈↓        <variable> <≠ <expression>

␈↓ ↓H␈↓causes␈α∪<expression>␈α∪to␈α∀be␈α∪removed␈α∪from␈α∀the␈α∪list␈α∪of␈α∀calculators␈α∪and␈α∪makes␈α∀the␈α∪appropriate
␈↓ ↓H␈↓modifications to the dependency lists.  Similarly,

␈↓ ↓H␈↓        <variable> <<= <expression>

␈↓ ↓H␈↓replaces the current calculator list for <expression>. The statement

␈↓ ↓H␈↓        <variable> <<= ;

␈↓ ↓H␈↓would cause the calculator list to be set to null.

␈↓ ↓H␈↓In␈α
addition␈α
to␈α
the␈α
calculator␈α
list,␈α
a␈α
list␈α
of␈α
␈↓βupdater␈↓␈α
routines␈α
is␈α
associated␈α
with␈α
every␈α
variable.␈α
 These
␈↓ ↓H␈↓routines␈α∂are␈α∞executed␈α∂whenever␈α∞the␈α∂variable␈α∞value␈α∂is␈α∞changed.␈α∂ Initially,␈α∞the␈α∂list␈α∞of␈α∂updaters␈α∞is
␈↓ ↓H␈↓empty.  However, the construct

␈↓ ↓H␈↓        WHEN CHANGING <variable> ALSO DO <label>: <statement>;

␈↓ ↓H␈↓will␈αcause␈αthe␈αstatement␈αto␈αbe␈αadded␈αto␈αthe␈αlist␈αof␈αupdaters␈αfor␈αthe␈αvariable.␈αThe␈αlabel␈αis␈αoptional,
␈↓ ↓H␈↓but␈αis␈αnecessary␈αif␈α
the␈αstatement␈αis␈αever␈α
to␈αbe␈αremoved␈αfrom␈α
the␈αupdater␈αlist.␈αIn␈α
<statement>,␈αthe
␈↓ ↓H␈↓reserved␈α∪words␈α∩OLD␈α∪and␈α∩NEW␈α∪may␈α∪be␈α∩used␈α∪to␈α∩refer␈α∪to␈α∪the␈α∩old␈α∪and␈α∩new␈α∪values␈α∪of␈α∩var,
␈↓ ↓H␈↓respectively.  For instance:

␈↓ ↓H␈↓        WHEN CHANGING f2 ALSO DO foo: f1 ← NEW*(OLD → F1);

␈↓ ↓H␈↓Updaters may be removed from the updater list by the statement

␈↓ ↓H␈↓        WHEN CHANGING <variable> DONT DO <label>

␈↓ ↓H␈↓For our above example, this would be

␈↓ ↓H␈↓        WHEN CHANGING f2 DONT DO foo;
␈↓ ↓H␈↓Page 42␈α?␈α?␈α?␈α?␈α?␈α?␈α≥GRAPH STRUCTURES␈↓ ∂2.4.1



␈↓ ↓H␈↓The form

␈↓ ↓H␈↓        WHEN CHANGING <variable> ONLY DO <statement>;

␈↓ ↓H␈↓replaces the updater list with one containing just <statement>, and

␈↓ ↓H␈↓        WHEN CHANGING <variable> ONLY DO ;

␈↓ ↓H␈↓clears␈α
the␈α
updater␈α
list␈α
completely.␈α
 Since␈α
the␈α
affix␈α
structure␈α
makes␈α
use␈α
of␈α
updater␈α
and␈α
calculator
␈↓ ↓H␈↓lists (see subsection 5.2.2), careless use of the replacement form is not advised.

␈↓ ↓H␈↓One possible use for updater routines is tracing.  For example,

␈↓ ↓H␈↓        WHEN CHANGING v ALSO DO
␈↓ ↓H␈↓                WRITE("The value of V is now ",NEW);

␈↓ ↓H␈↓One␈α
additional␈α
point␈α
that␈α
should␈α
be␈α
mentioned␈α
here␈α
is␈α
that␈α
the␈α
updater␈α
routines␈α
for␈α∞a␈α
variable
␈↓ ↓H␈↓are␈α␈↓βnot␈↓␈αcalled␈αif␈αthe␈αvariable's␈αvalue␈αis␈αmodified␈α
as␈αa␈αside␈αeffect␈αof␈αa␈αchange␈αto␈αsome␈α
variable␈αin
␈↓ ↓H␈↓one of its calculators.



␈↓ ↓H␈↓␈↓β2.4.2 GRAPH STRUCTURES AND AFFIXMENT␈↓

␈↓ ↓H␈↓As␈α∪mentioned␈α∪in␈α∪the␈α∪previous␈α∪section,␈α∀the␈α∪AFFIX␈α∪&␈α∪UNFIX␈α∪statements␈α∪modify␈α∀the␈α∪graph
␈↓ ↓H␈↓structure.␈α In␈αfact,␈αthese␈αstatements␈αmay␈αbe␈αbe␈αdefined␈αin␈αterms␈αof␈αtheir␈αeffects␈αon␈αgraph␈αstructure.
␈↓ ↓H␈↓Thus,

␈↓ ↓H␈↓        AFFIX f1 TO f2 BY t1

␈↓ ↓H␈↓is equivalent to

␈↓ ↓H␈↓        t1 ← f2 → f1;
␈↓ ↓H␈↓        f1 <= t1 * f2;
␈↓ ↓H␈↓        WHEN CHANGING f1 ALSO DO yyy:t1 ← (f2 → NEW);

␈↓ ↓H␈↓One␈α
additional␈α
effect␈αof␈α
AFFIX␈α
is␈αto␈α
cause␈α
the␈αcompiler's␈α
planning␈α
model␈αto␈α
be␈α
updated␈α
by␈αthe
␈↓ ↓H␈↓addition of a symbolic assertion:

␈↓ ↓H␈↓        ASSERT FORM(AFFIXED, f1, f2, NONRIGIDLY, t1);

␈↓ ↓H␈↓Such␈α∂assertions␈α∞are␈α∂described␈α∂more␈α∞fully␈α∂in␈α∞Section␈α∂3.4.␈α∂ Essentially,␈α∞all␈α∂this␈α∞one␈α∂does␈α∂is␈α∞record
␈↓ ↓H␈↓the␈α∀fact␈α∀that␈α∃the␈α∀two␈α∀frames␈α∃have␈α∀been␈α∀affixed.␈α∀ This␈α∃information␈α∀is␈α∀used␈α∃in␈α∀calculating
␈↓ ↓H␈↓deproaches␈α(Section␈α2.2.5)␈αand␈αby␈αseveral␈αother␈αparts␈αof␈αthe␈αcompiler,␈αand␈αis␈αalso␈αavailable␈αto␈αthe
␈↓ ↓H␈↓user.

␈↓ ↓H␈↓Similarly,

␈↓ ↓H␈↓        UNFIX f1 FROM f2;
␈↓ ↓H␈↓2.4.2␈α?␈α?␈α?␈α?␈α?␈α?␈α5GRAPH STRUCTURES␈↓ 
aPage 43



␈↓ ↓H␈↓is equivalent to

␈↓ ↓H␈↓        f1 <≠ t1*f2;
␈↓ ↓H␈↓        WHEN CHANGING f1 DONT DO yyy;
␈↓ ↓H␈↓        DENY FORM(AFFIXED, f1, f2, ANYTHING, ANYTHING);
␈↓ ↓H␈↓        ASSERT FORM(WAS_AFFIXED, f1, f2);

␈↓ ↓H␈↓The␈α∪latter␈α∩assertion␈α∪is␈α∪used␈α∩in␈α∪calculation␈α∪of␈α∩default␈α∪deproach␈α∪points.␈α∩A␈α∪side-effect␈α∪of␈α∩any
␈↓ ↓H␈↓assignment, like "f1 ← <value>", is

␈↓ ↓H␈↓        DENY FORM(WAS_AFFIXED, ANYTHING, f1);
␈↓ ↓H␈↓        DENY FORM(WAS_AFFIXED, f1, ANYTHING)     .

␈↓ ↓H␈↓Rigid affixments, such as

␈↓ ↓H␈↓        AFFIX f1 TO f2 BY t1 RIGIDLY

␈↓ ↓H␈↓are equivalent to

␈↓ ↓H␈↓        t1 ← f2 → f1;
␈↓ ↓H␈↓        f1 <= t1 * f2;
␈↓ ↓H␈↓        f2 <= INVERSE(t1) * f1     .
␈↓ ↓H␈↓        ASSERT FORM(AFFIXED, f1, f2, RIGIDLY, t1);






␈↓ ↓H␈↓␈↓∧2.5 CONTROL STRUCTURES␈↓



␈↓ ↓H␈↓␈↓β2.5.1 TRADITIONAL STRUCTURES␈↓

␈↓ ↓H␈↓'AL␈αhas␈αmany␈αof␈αthe␈αtraditional␈αAlgol␈αcontrol␈αstructures,␈αincluding␈α␈↓βstatements␈↓,␈α␈↓βblocks␈↓,␈α␈↓βconditionals␈↓,
␈↓ ↓H␈↓and␈α∩␈↓βloops␈↓.␈α∩ There␈α∩are␈α∪no␈α∩␈↓βjumps␈↓␈α∩in␈α∩'AL,␈α∩because␈α∪they␈α∩confuse␈α∩the␈α∩flow␈α∩analysis␈α∪needed␈α∩for
␈↓ ↓H␈↓maintaining planning values and because it is possible to accomplish much without them.

␈↓ ↓H␈↓We␈α∞have␈α∂already␈α∞seen␈α∂some␈α∞applications␈α∂of␈α∞block␈α∞structure.␈α∂ More␈α∞formally,␈α∂a␈α∞␈↓βblock␈↓␈α∂is␈α∞a␈α∂list␈α∞of
␈↓ ↓H␈↓␈↓βstatements␈↓,␈α∂separated␈α∞by␈α∂semicolons,␈α∞and␈α∂surrounded␈α∂by␈α∞the␈α∂reserved␈α∞words␈α∂␈↓βBEGIN␈↓␈α∂and␈α∞␈↓βEND␈↓.
␈↓ ↓H␈↓The␈α⊃entire␈α⊂block␈α⊃is␈α⊃treated␈α⊂syntactically␈α⊃as␈α⊃a␈α⊂statement;␈α⊃thus,␈α⊃its␈α⊂definition␈α⊃is␈α⊃recursive.␈α⊂ One
␈↓ ↓H␈↓particular␈α
kind␈α
of␈α∞statement␈α
is␈α
the␈α∞␈↓βdeclaration␈↓.␈α
 We␈α
have␈α∞already␈α
seen␈α
declarations␈α∞for␈α
algebraic
␈↓ ↓H␈↓variables.␈α There␈αare␈αa␈αfew␈αrules␈αpertaining␈α
to␈αvariables␈αand␈αdeclarations:␈αEvery␈αvariable␈αmust␈α
be
␈↓ ↓H␈↓declared␈αat␈αsome␈αpoint␈αin␈αthe␈αprogram␈αbefore␈αit␈αis␈αused.␈α Declarations␈αmay␈αappear␈αanywhere␈αin␈αa
␈↓ ↓H␈↓block;␈α
there␈αis␈α
no␈αrestriction␈α
that␈αthey␈α
must␈α
precede␈αother␈α
statements.␈α The␈α
␈↓βlocal␈αblock␈↓␈α
of␈αa␈α
variable
␈↓ ↓H␈↓is␈αthe␈αblock␈αdefined␈αby␈αthe␈αnarrowest␈αBEGIN-END␈αpair␈αwhich␈αsurrounds␈αits␈αdeclaration.␈α Blocks
␈↓ ↓H␈↓defined␈αby␈αnarrower␈αBEGIN-END␈αpairs␈αare␈αcalled␈α
␈↓βinner␈αblocks␈↓,␈αand␈αthose␈αdefined␈αby␈αwider␈α
pairs
␈↓ ↓H␈↓Page 44␈α?␈α?␈α?␈α?␈α?␈α?␈α∧CONTROL STRUCTURES␈↓ ∂2.5.1



␈↓ ↓H␈↓are␈α
called␈α␈↓βglobal␈α
blocks␈↓.␈α The␈α
primary␈αrule␈α
is␈α
that␈αvariables␈α
may␈αonly␈α
be␈αreferenced␈α
in␈α
their␈αown
␈↓ ↓H␈↓local␈α
or␈α∞inner␈α
blocks.␈α
 Another␈α∞way␈α
to␈α∞state␈α
the␈α
same␈α∞thing␈α
is␈α∞that␈α
within␈α
any␈α∞given␈α
block,␈α∞it␈α
is
␈↓ ↓H␈↓only legal to refer to variables declared locally or globally to that block.

␈↓ ↓H␈↓Here is a simple example which demonstrates the other standard ALGOL control structures:

␈↓ ↓H␈↓sample: BEGIN  {␈↓βMeaningless example␈↓}
␈↓ ↓H␈↓        SCALAR a, i;
␈↓ ↓H␈↓        a ← 2;
␈↓ ↓H␈↓        FOR i ← 1 STEP 1 UNTIL 10 DO a ← a*a;
␈↓ ↓H␈↓␈↓ βλ␈↓β{This is very likely to cause arithmetic overflow!}
␈↓ ↓H␈↓        WHILE a > 0 DO
␈↓ ↓H␈↓        loop:   BEGIN
␈↓ ↓H␈↓                a ← a - 1;
␈↓ ↓H␈↓                IF a < 5 THEN WRITE(a) ELSE WRITE(a-5)
␈↓ ↓H␈↓                END loop;
␈↓ ↓H␈↓        WRITE("Done")
␈↓ ↓H␈↓        END sample

␈↓ ↓H␈↓Even␈αthough␈αthere␈αis␈αno␈αjump␈αinstruction,␈αthere␈αare␈αlabels;␈αthey␈αare␈αuseful␈αduring␈αdebugging,␈αfor
␈↓ ↓H␈↓naming␈α⊂condition␈α⊃monitors,␈α⊂and␈α⊂for␈α⊃some␈α⊂other␈α⊂purposes␈α⊃which␈α⊂we␈α⊂will␈α⊃see␈α⊂later.␈α⊂ It␈α⊃is␈α⊂good
␈↓ ↓H␈↓practice␈αto␈αname␈αblocks,␈α
and␈αto␈αrepeat␈αthe␈α
name␈αafter␈αthe␈αclosing␈α
END;␈αthis␈αallows␈αthe␈αcompiler␈α
to
␈↓ ↓H␈↓check that the proper BEGINs and ENDs match.

␈↓ ↓H␈↓The ␈↓βFOR loop␈↓ is quite traditional; it follows the form:

␈↓ ↓H␈↓        FOR <s var> ← <s expr> STEP <s expr> UNTIL <s expr> DO <statement>

␈↓ ↓H␈↓where␈α<s␈αvar>␈αstands␈αfor␈α"(possibly␈αdimensioned)␈αscalar␈αvariable"␈αand␈α<s␈αexpr>␈αstands␈αfor␈α"scalar
␈↓ ↓H␈↓expression␈α
of␈α∞compatible␈α
dimension".␈α∞ The␈α
initial␈α
value␈α∞of␈α
the␈α∞variable␈α
is␈α
the␈α∞value␈α
of␈α∞the␈α
first
␈↓ ↓H␈↓expression;␈α⊂every␈α⊂time␈α∂the␈α⊂statement␈α⊂is␈α⊂executed,␈α∂its␈α⊂value␈α⊂is␈α⊂incremented␈α∂by␈α⊂the␈α⊂value␈α⊂of␈α∂the
␈↓ ↓H␈↓second␈αexpression,␈αand␈αthe␈αprocess␈αrepeats␈αuntil␈α
the␈αvalue␈αexceeds␈αthat␈αof␈αthe␈αthird␈αexpression.␈α
 If
␈↓ ↓H␈↓the␈αstep␈αsize␈αis␈αnegative,␈αthe␈αright␈αthings␈αhappen.␈α A␈αtest␈αis␈αmade␈αbefore␈αthe␈αfirst␈αiteration,␈αso␈αit␈αis
␈↓ ↓H␈↓possible that the loop will not get executed at all.

␈↓ ↓H␈↓The ␈↓βWHILE loop␈↓ is another means to control iteration.  It syntax is this:

␈↓ ↓H␈↓        WHILE <condition> DO <statement>

␈↓ ↓H␈↓where␈α
the␈αcondition␈α
is␈αsome␈α
boolean␈αexpression␈α
involving␈αone␈α
of␈α
the␈αoperators␈α
<,␈α>,␈α
≤,␈α≥,␈α
=,␈αand␈α
≠.
␈↓ ↓H␈↓Boolean␈α∞expressions␈α∞can␈α∞be␈α∞built␈α∞up␈α∞out␈α∞of␈α∞such␈α∞arithmetic␈α∞operators,␈α∞the␈α∞logical␈α∞connectives␈α∞␈↓β∧
␈↓ ↓H␈↓β(and),␈α∞∨␈α∞(or),␈α∂¬␈α∞(not)␈↓,␈α∞and␈α∂the␈α∞logical␈α∞constants␈α∞␈↓βtrue␈↓␈α∂and␈α∞␈↓βfalse␈↓.␈α∞ The␈α∂first␈α∞check␈α∞is␈α∂made␈α∞before
␈↓ ↓H␈↓the first iteration; the statement is executed repeatedly until the condition fails.

␈↓ ↓H␈↓The ␈↓βconditional statement␈↓ has the form:

␈↓ ↓H␈↓        IF <condition>
␈↓ ↓H␈↓                THEN <statement>
␈↓ ↓H␈↓                ELSE <statement>
␈↓ ↓H␈↓2.5.1␈α?␈α?␈α?␈α?␈α?␈α?␈α≤CONTROL STRUCTURES␈↓ 
aPage 45



␈↓ ↓H␈↓The␈α⊂ELSE␈α⊂part␈α⊂is␈α⊃optional.␈α⊂ The␈α⊂<condition>,␈α⊂which␈α⊂is␈α⊃just␈α⊂like␈α⊂the␈α⊂condition␈α⊂in␈α⊃a␈α⊂WHILE
␈↓ ↓H␈↓statement,␈αis␈αevaluated;␈αif␈αit␈αis␈α␈↓βtrue␈↓,␈αthe␈αTHEN␈αpart␈αwill␈αget␈αexecuted;␈αif␈αit␈αis␈α␈↓βfalse␈↓,␈αthe␈αELSE␈αpart
␈↓ ↓H␈↓(if there is one) gets executed.

␈↓ ↓H␈↓The ␈↓βconditional expression␈↓ is much the same as the conditional statement:

␈↓ ↓H␈↓        IF <condition>
␈↓ ↓H␈↓                THEN <expression>
␈↓ ↓H␈↓                ELSE <expression>

␈↓ ↓H␈↓This can be used whenever an expression is needed.



␈↓ ↓H␈↓␈↓β2.5.2 COBEGIN-COEND␈↓

␈↓ ↓H␈↓In␈α∩addition␈α∩to␈α∪traditional␈α∩ALGOL␈α∩structures,␈α∪there␈α∩are␈α∩also␈α∪some␈α∩additional␈α∩ones␈α∪for␈α∩more
␈↓ ↓H␈↓sophisticated␈α⊃flow␈α⊃of␈α⊂control.␈α⊃ The␈α⊃first␈α⊂such␈α⊃construct␈α⊃is␈α⊂the␈α⊃␈↓βCOBEGIN-COEND␈↓␈α⊃pair,␈α⊂which
␈↓ ↓H␈↓brackets␈α⊂statements␈α⊂whose␈α⊃execution␈α⊂is␈α⊂meant␈α⊂to␈α⊃occur␈α⊂independently.␈α⊂ Each␈α⊂of␈α⊃the␈α⊂statements
␈↓ ↓H␈↓within␈αthe␈α␈↓βsimultaneous␈↓␈αblock␈αwill␈αeventually␈αget␈αexecuted,␈αbut␈αthere␈αmay␈αbe␈αconsiderable␈αoverlap
␈↓ ↓H␈↓of␈αexecution.␈α
 For␈αexample,␈α
while␈αone␈α
arm␈αis␈α
moving,␈αanother␈α
statement␈αcan␈α
be␈αcomputing;␈α
several
␈↓ ↓H␈↓arms␈α
can␈α
also␈α
work␈α
at␈α∞the␈α
same␈α
time.␈α
The␈α
termination␈α
of␈α∞the␈α
block␈α
occurs␈α
only␈α
when␈α
all␈α∞of␈α
the
␈↓ ↓H␈↓statements␈αin␈αthe␈αscope␈αof␈αthe␈αCOBEGIN␈αhave␈αterminated.␈α Declarations␈αshould␈αnot␈α
be␈αincluded
␈↓ ↓H␈↓as␈αlocal␈αstatements␈αin␈αthe␈α
region␈αof␈αsimultaneity.␈α It␈αis␈α
not␈αparticularly␈αuseful␈αto␈αhave␈α
simultaneous
␈↓ ↓H␈↓execution␈αof␈αa␈αpurely␈αcomputational␈αcode;␈αthe␈αreal␈αreason␈αfor␈αthe␈αCOBEGIN␈αconstruct␈αis␈αto␈αallow
␈↓ ↓H␈↓simultaneous independent manipulator control.  Here is a simple example:

␈↓ ↓H␈↓swing:  COBEGIN  {␈↓βWish to get all three arms to their rest positions.␈↓}
␈↓ ↓H␈↓        MOVE yellow TO ypark;

␈↓ ↓H␈↓        MOVE blue TO bpark;

␈↓ ↓H␈↓        MOVE red {␈↓βwe should have such an arm␈↓} TO rpark;
␈↓ ↓H␈↓        COEND swing




␈↓ ↓H␈↓␈↓β2.5.3 PARTIAL ORDERING OF SUBTASKS␈↓

␈↓ ↓H␈↓An␈αassembly␈α
task␈αis␈αoften␈α
divided␈αinto␈αsubtasks␈α
which␈αenjoy␈α
a␈αpartial␈αordering␈α
with␈αrespect␈αto␈α
the
␈↓ ↓H␈↓intended␈αorder␈αof␈αexecution.␈α For␈αexample,␈αconsider␈αa␈αtask␈αA␈αwhich␈αcontains␈αfour␈αsubtasks,␈αB,␈αC,
␈↓ ↓H␈↓D,␈αand␈αE,␈αof␈α
which␈αB␈αand␈αC␈αmust␈α
be␈αdone␈αbefore␈αD,␈α
and␈αD␈αmust␈αbe␈αdone␈α
before␈αE,␈αbut␈αB␈αand␈α
C
␈↓ ↓H␈↓could␈αbe␈αdone␈αin␈αany␈αorder.␈α It␈αis␈αpossible␈αin␈α'AL␈αto␈αleave␈αthe␈αordering␈αof␈αthe␈αsubtasks␈αup␈αto␈αthe
␈↓ ↓H␈↓compiler,␈α
which␈α
will␈α
try␈α∞to␈α
optimize␈α
the␈α
entire␈α
operation␈α∞with␈α
respect␈α
to␈α
total␈α
expected␈α∞time␈α
and
␈↓ ↓H␈↓economy of motion.  For example,
␈↓ ↓H␈↓Page 46␈α?␈α?␈α?␈α?␈α?␈α?␈α∧CONTROL STRUCTURES␈↓ ∂2.5.3



␈↓ ↓H␈↓     a: TASK BEGIN { ␈↓βSample of partial ordering on subtasks␈↓ }
␈↓ ↓H␈↓             b: BEGIN
␈↓ ↓H␈↓                <code for task B>
␈↓ ↓H␈↓                END b;

␈↓ ↓H␈↓             c: <code for task C>;

␈↓ ↓H␈↓           d_e: BEGIN { ␈↓βboth D and E␈↓ }
␈↓ ↓H␈↓                <code for task D>
␈↓ ↓H␈↓                <code for task E>
␈↓ ↓H␈↓                END d_e;

␈↓ ↓H␈↓        PREREQUISITE OF d_e IS c;
␈↓ ↓H␈↓        PREREQUISITE OF d_e IS b;
␈↓ ↓H␈↓        END


␈↓ ↓H␈↓The␈α∩words␈α∩TASK␈α∩BEGIN␈α⊃introduce␈α∩a␈α∩␈↓βtask␈α∩block␈↓,␈α∩which␈α⊃contains␈α∩a␈α∩set␈α∩of␈α∩statements.␈α⊃ The
␈↓ ↓H␈↓prerequisite statement

␈↓ ↓H␈↓        PREREQUISITE OF <label 1> IS <label 2>

␈↓ ↓H␈↓informs␈αthe␈αcompiler␈αthat␈αthe␈αstatement␈αidentified␈α
by␈α<label␈α2>␈αmust␈αbe␈αdone␈αbefore␈αthe␈α
statement
␈↓ ↓H␈↓identified␈αby␈α
<label␈α1>.␈α
 One␈αimportant␈α
restriction␈αis␈αthat␈α
both␈αstatements␈α
so␈αnamed,␈α
as␈αwell␈αas␈α
the
␈↓ ↓H␈↓prerequisite statement itself, must all occur in the same TASK block.

␈↓ ↓H␈↓The␈α
order␈α
in␈α
which␈α
the␈α
statements␈α
are␈α
performed␈α
is␈α
determined␈α
only␈α
insofar␈α
as␈α
the␈α
prerequisite
␈↓ ↓H␈↓conditions␈αdemand.␈α The␈αcompiler␈αmay␈αreorder␈αthem␈αconsistently␈αwith␈αthe␈αpreconditions,␈αand␈αmay
␈↓ ↓H␈↓even␈α⊂execute␈α∂some␈α⊂of␈α∂the␈α⊂statements␈α∂simultaneously␈α⊂(as␈α∂if␈α⊂there␈α∂were␈α⊂a␈α∂COBEGIN),␈α⊂if␈α⊂this␈α∂is
␈↓ ↓H␈↓feasible.

␈↓ ↓H␈↓As␈αcan␈αbe␈αexpected,␈αit␈αis␈αrather␈αdifficult␈αfor␈αthe␈αcompiler␈αto␈αkeep␈αtrack␈αof␈αplanning␈αvalues␈αin␈αthe
␈↓ ↓H␈↓vicinity␈αof␈αa␈αTASKBEGIN.␈α For␈αthis␈αreason,␈αit␈αis␈αa␈αgood␈αidea␈αto␈αmake␈αheavy␈αuse␈αof␈αthe␈αplanning
␈↓ ↓H␈↓value␈α∂assignment␈α∂statement␈α⊂(the␈α∂one␈α∂with␈α∂the␈α⊂double␈α∂arrow:␈α∂"←←";␈α∂see␈α⊂Section␈α∂3.2)␈α∂to␈α⊂keep␈α∂the
␈↓ ↓H␈↓compiler␈α∞informed␈α∂of␈α∞what␈α∞is␈α∂intended␈α∞to␈α∞be␈α∂true,␈α∞both␈α∞within␈α∂the␈α∞partially␈α∞ordered␈α∂block␈α∞and
␈↓ ↓H␈↓immediately afterwards.



␈↓ ↓H␈↓␈↓β2.5.4 EVENTS: SIGNAL AND WAIT␈↓

␈↓ ↓H␈↓To␈α⊂achieve␈α⊂simultaneous␈α∂coordinated␈α⊂motion,␈α⊂one␈α∂uses␈α⊂a␈α⊂special␈α∂form␈α⊂of␈α⊂the␈α⊂move␈α∂commands
␈↓ ↓H␈↓which␈α∩will␈α∪be␈α∩discussed␈α∪later.␈α∩ However,␈α∩some␈α∪simple␈α∩synchronization␈α∪is␈α∩possible␈α∪within␈α∩the
␈↓ ↓H␈↓context␈α∞of␈α∞simultaneous␈α∞execution.␈α∞ This␈α∞is␈α∞achieved␈α
by␈α∞means␈α∞of␈α∞explicit␈α∞events,␈α∞which␈α∞can␈α
be
␈↓ ↓H␈↓signaled␈αand␈αawaited.␈α Every␈αdifferent␈αevent␈αthat␈αthe␈αuser␈αwishes␈αto␈αuse␈αshould␈αbe␈αdeclared.␈α For
␈↓ ↓H␈↓instance,

␈↓ ↓H␈↓        EVENT e1, e2, e3     .
␈↓ ↓H␈↓2.5.4␈α?␈α?␈α?␈α?␈α?␈α?␈α≤CONTROL STRUCTURES␈↓ 
aPage 47



␈↓ ↓H␈↓With␈α
each␈α
event␈α
is␈α
associated␈α
a␈α
count␈α
of␈α
how␈α
many␈α
times␈α
it␈α
has␈α
been␈α
signalled.␈α
 Initially,␈αthe␈α
count
␈↓ ↓H␈↓is 0, that is, no signals have appeared, and no process is waiting.  The statement

␈↓ ↓H␈↓        SIGNAL e1

␈↓ ↓H␈↓increments␈αthe␈αcount␈α
associated␈αwith␈αevent␈α
e1,␈αand␈αif␈αthe␈α
resulting␈αcount␈αis␈α
0␈αor␈αnegative,␈α
one␈αof
␈↓ ↓H␈↓those processes waiting for e1 is released from its wait and readied for execution.  The statement

␈↓ ↓H␈↓        WAIT e1

␈↓ ↓H␈↓decrements␈αthe␈αcount␈αassociated␈αwith␈αevent␈αE1,␈αand␈αif␈αthe␈αresulting␈αcount␈αis␈αnegative,␈αthe␈αprocess
␈↓ ↓H␈↓issuing␈α∞the␈α∞WAIT␈α∞is␈α∂blocked␈α∞from␈α∞continuing␈α∞until␈α∂a␈α∞signal␈α∞comes␈α∞along.␈α∂ If␈α∞the␈α∞count␈α∞is␈α∂0␈α∞or
␈↓ ↓H␈↓positive, there is no waiting.

␈↓ ↓H␈↓An␈α⊂example␈α∂of␈α⊂the␈α∂utility␈α⊂of␈α∂this␈α⊂construct␈α∂is␈α⊂inside␈α∂a␈α⊂simultaneous␈α∂block,␈α⊂where␈α∂one␈α⊂path␈α∂of
␈↓ ↓H␈↓execution␈αrequires␈αthat␈αthe␈αother␈αpath␈αhas␈αpassed␈αsome␈αmilestone.␈α Here␈αis␈αhow␈αsuch␈αa␈αuse␈αmight
␈↓ ↓H␈↓appear:

␈↓ ↓H␈↓        EVENT milestone;
␈↓ ↓H␈↓        COBEGIN {␈↓βExample of use of SIGNAL and WAIT␈↓}
␈↓ ↓H␈↓         path1: BEGIN
␈↓ ↓H␈↓                <code before the critical point>
␈↓ ↓H␈↓                WAIT milestone;
␈↓ ↓H␈↓                <code after the critical point>
␈↓ ↓H␈↓                END path1;

␈↓ ↓H␈↓         path2: BEGIN
␈↓ ↓H␈↓                <code in preparation for the milestone>
␈↓ ↓H␈↓                SIGNAL milestone;
␈↓ ↓H␈↓                <code following the milestone>
␈↓ ↓H␈↓                END path2
␈↓ ↓H␈↓        COEND




␈↓ ↓H␈↓␈↓β2.5.5 STATEMENT CONDITION MONITORS␈↓

␈↓ ↓H␈↓We␈α
have␈α
already␈α
seen␈α
condition␈α
monitors␈αin␈α
the␈α
context␈α
of␈α
motion␈α
statements.␈α
 The␈αsame␈α
construct
␈↓ ↓H␈↓is␈α∂of␈α∞general␈α∂utility;␈α∞most␈α∂of␈α∞what␈α∂was␈α∞said␈α∂before␈α∞holds␈α∂for␈α∞the␈α∂␈↓βstatement␈α∞condition␈α∂monitor␈↓␈α∞as
␈↓ ↓H␈↓well.

␈↓ ↓H␈↓The␈αconditions␈αwhich␈αmay␈αbe␈αtested␈α
in␈αstatement␈αcondition␈αmonitors␈αare␈αprincipally␈α
events,␈αsince
␈↓ ↓H␈↓DURATION,␈αSQUEEZE,␈αand␈α
FORCE␈αare␈αassociated␈α
usually␈αwith␈αa␈α
particular␈αmotion.␈α As␈αis␈α
the
␈↓ ↓H␈↓case␈α
with␈α
motion␈α
condition␈α
monitors,␈α
the␈α
statement␈α
condition␈α
monitors␈α
can␈α
be␈α
in␈α
two␈αstates:␈α
␈↓βenabled␈↓
␈↓ ↓H␈↓and␈α∞␈↓βdisabled␈↓.␈α∞A␈α∞monitor␈α
becomes␈α∞enabled␈α∞when␈α∞its␈α
defining␈α∞statement␈α∞is␈α∞executed,␈α∞and␈α
becomes
␈↓ ↓H␈↓disabled␈αwhen␈α
it␈αtriggers,␈α
is␈αexplicitly␈α
disabled␈αby␈α
some␈αother␈α
statement,␈αor␈α
its␈αlocal␈α
block␈αis␈α
exited.
␈↓ ↓H␈↓The␈αsame␈αconventions␈αas␈αhave␈αalready␈αbeen␈αseen␈αapply␈αto␈αthe␈αnaming␈αof␈αcondition␈αmonitors␈αand
␈↓ ↓H␈↓Page 48␈α?␈α?␈α?␈α?␈α?␈α?␈α∧CONTROL STRUCTURES␈↓ ∂2.5.5



␈↓ ↓H␈↓their␈α∩explicit␈α∪enabling␈α∩and␈α∩disabling.␈α∪ Scope␈α∩rules␈α∩come␈α∪into␈α∩play␈α∩regarding␈α∪what␈α∩condition
␈↓ ↓H␈↓monitors␈α⊂it␈α∂is␈α⊂permitted␈α∂to␈α⊂enable␈α∂or␈α⊂disable;␈α∂the␈α⊂rule␈α∂is␈α⊂that␈α∂only␈α⊂condition␈α⊂monitors␈α∂defined
␈↓ ↓H␈↓locally␈α
or␈α
globally␈αto␈α
a␈α
piece␈αof␈α
code␈α
can␈αbe␈α
touched␈α
by␈αthat␈α
code.␈α
 The␈αword␈α
DEFER␈α
still␈αcauses␈α
a
␈↓ ↓H␈↓condition monitor to be defined in an initially disabled state.

␈↓ ↓H␈↓When␈α
a␈α
block␈α
is␈α
exited,␈α
all␈α
monitors␈α
local␈αto␈α
that␈α
block␈α
are␈α
disabled.␈α
 However,␈α
the␈α
block␈αexit␈α
code
␈↓ ↓H␈↓will␈αwait␈αuntil␈αthe␈αbodies␈αof␈αany␈αtriggered␈αmonitors␈αare␈αcompleted␈αbefore␈αdisabling␈αany␈αmonitors,
␈↓ ↓H␈↓deallocating␈α∩local␈α⊃variables,␈α∩or␈α⊃performaing␈α∩any␈α⊃of␈α∩the␈α⊃other␈α∩functions␈α⊃associated␈α∩with␈α⊃block
␈↓ ↓H␈↓termination.␈α∞ If␈α
the␈α∞execution␈α
of␈α∞one␈α∞of␈α
these␈α∞triggered␈α
monitor␈α∞bodies␈α
causes␈α∞other␈α∞monitors␈α
to
␈↓ ↓H␈↓trigger,␈α⊂then␈α∂the␈α⊂block␈α⊂exit␈α∂will␈α⊂wait␈α⊂for␈α∂those,␈α⊂also.␈α∂ Furthermore,␈α⊂block␈α⊂exit␈α∂is␈α⊂treated␈α⊂as␈α∂an
␈↓ ↓H␈↓atomic process; all monitors are disabled at the same time.

␈↓ ↓H␈↓The␈α
constructs␈α
CRITICAL␈αand␈α
UNCRITICAL␈α
apply␈α
to␈αstatement␈α
condition␈α
monitors␈α
just␈αas␈α
they
␈↓ ↓H␈↓do to motion condition monitors.



␈↓ ↓H␈↓␈↓β2.5.6 COMMENTS␈↓

␈↓ ↓H␈↓The␈α∞most␈α∞standard␈α∞way␈α∞to␈α∞insert␈α∞comments␈α∞in␈α
an␈α∞'AL␈α∞program␈α∞is␈α∞to␈α∞surround␈α∞them␈α∞with␈α
curly
␈↓ ↓H␈↓brackets,␈α
as␈α
we␈α
have␈αdone␈α
in␈α
all␈α
our␈α
examples␈αso␈α
far.␈α
 It␈α
is␈α
also␈αlegal␈α
to␈α
use␈α
the␈αword␈α
COMMENT
␈↓ ↓H␈↓before␈α∂a␈α∂comment,␈α∂and␈α∂to␈α∞end␈α∂it␈α∂by␈α∂a␈α∂semicolon.␈α∂ This␈α∞type␈α∂of␈α∂comment␈α∂may␈α∂not␈α∂contain␈α∞any
␈↓ ↓H␈↓semicolon.␈α The␈α
user␈αcan␈α
optionally␈αreset␈α
the␈αcomment␈α
delimiters␈αfrom␈α
"{}"␈αto␈α
whatever␈αshe␈α
wishes,
␈↓ ↓H␈↓by means of a require statement such as

␈↓ ↓H␈↓        REQUIRE "%%" COMMENT_DELIMITERS       .

␈↓ ↓H␈↓which␈αwould␈αcause␈αthe␈αscanner␈αto␈αignore␈αany␈αtext␈αbetween␈α"%"␈αsigns.␈α It␈αis␈αexpected␈αthat␈α
this␈αwill
␈↓ ↓H␈↓seldom be needed.



␈↓ ↓H␈↓␈↓β2.5.7 LABELS␈↓

␈↓ ↓H␈↓␈↓βLabels␈↓␈αspecify␈α
points␈αin␈α
the␈αprogram;␈αthey␈α
are␈αuseful␈α
for␈αnaming␈α
condition␈αmonitors,␈αand␈α
subtasks.
␈↓ ↓H␈↓It␈α
also␈α
assists␈αduring␈α
debugging␈α
of␈αprograms.␈α
 To␈α
label␈αa␈α
statement,␈α
preface␈αit␈α
with␈α
an␈αidentifier
␈↓ ↓H␈↓followed by a colon.  Labels are not declared.

␈↓ ↓H␈↓        foo: a ← a + 1;




␈↓ ↓H␈↓␈↓β2.5.8 ABORT␈↓

␈↓ ↓H␈↓Occasionally␈α⊂the␈α⊂user␈α⊂wishes␈α⊂to␈α⊂stipulate␈α⊃that␈α⊂if␈α⊂the␈α⊂program␈α⊂ever␈α⊂reaches␈α⊂a␈α⊃particular␈α⊂point,
␈↓ ↓H␈↓something␈α∂is␈α∂hopelessly␈α∂wrong.␈α∞ The␈α∂statement␈α∂ABORT␈α∂causes␈α∞the␈α∂runtime␈α∂to␈α∂stop␈α∂all␈α∞moving
␈↓ ↓H␈↓devices␈αand␈α
to␈αterminate␈αexecution.␈α
 The␈αsupervisor␈αis␈α
informed␈αof␈αthe␈α
halt,␈αand␈αwill␈α
inform␈αthe
␈↓ ↓H␈↓2.5.8␈α?␈α?␈α?␈α?␈α?␈α?␈α≤CONTROL STRUCTURES␈↓ 
aPage 49



␈↓ ↓H␈↓user.␈α
ABORT␈αtakes␈α
an␈αoptional␈α
string␈αargument,␈α
which␈αis␈α
a␈αmessage␈α
which␈αwill␈α
be␈αgiven␈α
to␈αthe
␈↓ ↓H␈↓user if the ABORT statement is executed.  An example:

␈↓ ↓H␈↓        ABORT ("I keep missing the hole!")




␈↓ ↓H␈↓␈↓β2.5.9 OUTPUT␈↓

␈↓ ↓H␈↓There␈αare␈α
several␈αways␈α
that␈αthe␈α
user␈αcan␈αrequest␈α
output␈αfrom␈α
'AL␈αto␈α
the␈αconsole.␈α
 As␈αmentioned
␈↓ ↓H␈↓above,␈αABORT␈αcan␈αprint␈αa␈αmessage␈αduring␈αexecution.␈α There␈αis␈αanother␈αway␈αto␈αprint␈αa␈αmessage
␈↓ ↓H␈↓during␈α∪execution,␈α∪the␈α∪WRITE␈α∪statement,␈α∪which␈α∪takes␈α∪as␈α∪arguments␈α∪a␈α∪list␈α∪of␈α∪variables␈α∪and
␈↓ ↓H␈↓constants.␈α It␈αis␈αalso␈αlegal␈αto␈αinclude␈αa␈α
string␈αconstant␈αin␈αthis␈αlist␈α(there␈αare␈αno␈αstring␈α
variables␈αin
␈↓ ↓H␈↓'AL).  Formatting of output is automatic.  An example:

␈↓ ↓H␈↓        WRITE ("I think that the pump is at ",PUMP)


␈↓ ↓H␈↓Some␈α
pieces␈α
of␈α
code␈α
are␈α
only␈α
intended␈α
to␈α
work␈α
under␈α
certain␈α
conditions␈α
of␈α∞planning␈α
knowledge.
␈↓ ↓H␈↓Such␈α
code␈αmight␈α
have␈α
a␈αcheck␈α
to␈α
insure␈αthat␈α
its␈αpreconditions␈α
are␈α
met;␈αif␈α
not,␈α
it␈αis␈α
proper␈αto␈α
signal
␈↓ ↓H␈↓a␈α∞compile-time␈α∞error,␈α∞with␈α∞a␈α∞message.␈α∞ This␈α∞is␈α∞done␈α∞with␈α∞the␈α∞PLAN␈α∞ERROR␈α∞statement,␈α∞which
␈↓ ↓H␈↓optionally␈αtakes␈α
a␈αstring␈αargument,␈α
and␈αwhich␈αwill␈α
halt␈αcompilation␈αand␈α
print␈αthe␈α
message.␈α One
␈↓ ↓H␈↓of␈αthe␈αoptions␈αthe␈αsupervisor␈αwill␈αgive␈αthe␈αuser␈αis␈αto␈αproceed␈αas␈αif␈αno␈αerror␈αhad␈αbeen␈αencountered.
␈↓ ↓H␈↓Here is an example:

␈↓ ↓H␈↓        PLAN ERROR("Hey!  You didn't attach the pump to the hand!")


␈↓ ↓H␈↓A␈α
similar␈α
statement␈α
which␈α
merely␈α
prints␈α
its␈α
message␈α
but␈α
does␈α
not␈α
halt␈α
compilation␈α
is␈α∞the␈α
PLAN
␈↓ ↓H␈↓WRITE␈α
statement,␈αwhich␈α
behaves␈αin␈α
all␈αrespects␈α
like␈αthe␈α
runtime␈αWRITE␈α
statement␈αin␈α
that␈αit␈α
can
␈↓ ↓H␈↓take␈α
variables␈αand␈α
constants␈αin␈α
its␈αargument␈α
list,␈αbut␈α
where␈αvariables␈α
are␈αspecified,␈α
the␈αplanning
␈↓ ↓H␈↓values will be printed.  For example:

␈↓ ↓H␈↓        PLAN WRITE("Yellow arm should be at",yellow)




␈↓ ↓H␈↓␈↓β2.5.10 PROCEDURES␈↓

␈↓ ↓H␈↓'AL␈α∩has␈α∪only␈α∩a␈α∩limited␈α∪capacity␈α∩for␈α∩procedures.␈α∪ All␈α∩parameters␈α∩to␈α∪a␈α∩procedure␈α∪assume␈α∩the
␈↓ ↓H␈↓planning␈αvalue␈α"undefined"␈αat␈αthe␈αconclusion␈αof␈αa␈αprocedure␈αcall,␈αexcept␈αthose␈αwhich␈αare␈αdeclared
␈↓ ↓H␈↓as␈α∂VALUE␈α∞parameters␈α∂in␈α∞the␈α∂procedure␈α∞heading,␈α∂or␈α∞those␈α∂stated␈α∞to␈α∂be␈α∞UNCHANGED␈α∂in␈α∞the
␈↓ ↓H␈↓procedure␈α⊗call.␈α∃There␈α⊗is␈α∃no␈α⊗safeguard␈α∃against␈α⊗the␈α∃accidental␈α⊗modification␈α⊗of␈α∃"unchanged"
␈↓ ↓H␈↓parameters;␈αto␈αstate␈α"unchanged"␈αis␈αentirely␈αequivalent␈αto␈αan␈αassertion␈αthat␈αthe␈αparameter␈αhas␈αnot
␈↓ ↓H␈↓changed its value during the execution of the procedure.  The declaration of a procedure is this:

␈↓ ↓H␈↓         type PROCEDURE name (argument list)     ,
␈↓ ↓H␈↓Page 50␈α?␈α?␈α?␈α?␈α?␈α?␈α∧CONTROL STRUCTURES␈↓ 2.5.10



␈↓ ↓H␈↓where␈α␈↓βtype␈↓␈αis␈αany␈αdata␈αtype␈α(and␈αis␈αoptional),␈αand␈α␈↓βargument␈αlist␈↓␈αis␈αa␈αlist␈αof␈αparameter␈αnames␈αwith
␈↓ ↓H␈↓their types.  An example:

␈↓ ↓H␈↓        DISTANCE SCALAR PROCEDURE lgth (FRAME f1, f2; VECTOR VALUE v1);

␈↓ ↓H␈↓This␈αdeclares␈αthat␈αlgth␈αis␈αa␈αprocedure␈αwhich␈αreturns␈αa␈αscalar,␈αand␈αtakes␈αas␈αarguments␈αtwo␈αframes
␈↓ ↓H␈↓and one vector.  The vector is not changed by the procedure.

␈↓ ↓H␈↓To call such a procedure:

␈↓ ↓H␈↓        DISTANCE SCALAR s1;
␈↓ ↓H␈↓        FRAME frob, hole;
␈↓ ↓H␈↓        VECTOR vect;
␈↓ ↓H␈↓        :
␈↓ ↓H␈↓        s1 ← lgth(frob, UNCHANGED hole, vect);

␈↓ ↓H␈↓This further asserts that hole is not changed by the call.

␈↓ ↓H␈↓It␈αis␈αa␈αgood␈αidea␈α
to␈αuse␈αthe␈αplanning␈αvalue␈αassignment␈α
("←←")␈αheavily␈αat␈αthe␈αstart␈αof␈α
a␈αprocedure
␈↓ ↓H␈↓body␈α
to␈α∞inform␈α
the␈α∞compiler␈α
of␈α
the␈α∞values␈α
to␈α∞expect␈α
for␈α
the␈α∞various␈α
arguments.␈α∞Remember␈α
that
␈↓ ↓H␈↓trajectories␈α
planned␈α∞on␈α
the␈α
basis␈α∞of␈α
highly␈α
inaccurate␈α∞planning␈α
values␈α
will␈α∞not␈α
work␈α
well.␈α∞ As␈α
a
␈↓ ↓H␈↓procedure␈α
is␈α
entered,␈α
all␈αvariables␈α
have␈α
planning␈α
value␈α"undefined".␈α
 Globals␈α
may␈α
be␈αaccessed,␈α
but
␈↓ ↓H␈↓they␈α∂also␈α∂have␈α∂undefined␈α∞initial␈α∂planning␈α∂value.␈α∂ All␈α∞variables␈α∂which␈α∂have␈α∂explicit␈α∂or␈α∞implicit
␈↓ ↓H␈↓assignments␈α⊃within␈α⊃a␈α⊃procedure␈α⊃acquire␈α⊃the␈α⊂value␈α⊃"undefined"␈α⊃at␈α⊃the␈α⊃point␈α⊃directly␈α⊃after␈α⊂the
␈↓ ↓H␈↓procedure call.

␈↓ ↓H␈↓No␈α∂modification␈α∂of␈α∂the␈α∂affixment␈α∂structure␈α∂is␈α∂allowed␈α∂inside␈α∂a␈α∂procedure.␈α∂The␈α∂compiler␈α∂(often
␈↓ ↓H␈↓wrongly)␈αassumes␈αthat␈αthere␈αare␈αno␈αaffixments␈αinvolving␈αvariables␈αwithin␈αa␈αprocedure;␈αit␈αrequires
␈↓ ↓H␈↓an assertion like

␈↓ ↓H␈↓        ASSERT FORM(AFFIXED, f1, f2)   .

␈↓ ↓H␈↓to␈α
override␈αthis␈α
mistake.␈α
 Affixments␈αare␈α
discussed␈α
in␈αSection␈α
2.3␈α
and␈αmore␈α
general␈α
assertions␈αin
␈↓ ↓H␈↓Section 3.4.

␈↓ ↓H␈↓There␈αare␈α
four␈αspecial␈αtypes␈α
of␈αprocedure␈αcalls:␈α
A␈α'AL␈αprogram␈α
might␈αwish␈αto␈α
call␈αa␈αroutine␈α
coded
␈↓ ↓H␈↓for␈α∩the␈α∩mini␈α⊃or␈α∩a␈α∩routine␈α∩coded␈α⊃for␈α∩the␈α∩timesharing␈α∩machine.␈α⊃ Likewise,␈α∩a␈α∩program␈α∩on␈α⊃the
␈↓ ↓H␈↓timesharing␈αcomputer␈αmay␈αwish␈αto␈αcontrol␈αan␈α'AL␈αprogram,␈αor␈αa␈αroutine␈αon␈αthe␈αmini␈αmay␈αwish␈αto
␈↓ ↓H␈↓request some arm motion.

␈↓ ↓H␈↓To␈α∞achieve␈α∞the␈α∞first␈α∞two␈α
cases,␈α∞there␈α∞exist␈α∞␈↓βexternal␈α∞procedures␈↓␈α
in␈α∞'AL.␈α∞ These␈α∞are␈α∞compiled␈α
into
␈↓ ↓H␈↓calls␈α
on␈α
either␈α
routines␈α
in␈α
the␈α
mini␈α
or␈α
routines␈α
in␈α
the␈α
timesharing␈α
computer's␈α
runtime␈α
package.␈α
 To
␈↓ ↓H␈↓declare such a procedure:

␈↓ ↓H␈↓        EXTERNAL MAXI FRAME PROCEDURE foo (FRAME a, b; VECTOR v)    .

␈↓ ↓H␈↓This␈α∩declares␈α∩the␈α∩procedure␈α∩foo␈α∩to␈α∩be␈α∩a␈α∩procedure␈α∩resident␈α∩in␈α∩the␈α∩runtime␈α∩"maxi"␈α∪(that␈α∩is,
␈↓ ↓H␈↓timesharing␈α∞computer)␈α
package,␈α∞expected␈α
to␈α∞return␈α
a␈α∞frame␈α
value,␈α∞and␈α
taking␈α∞as␈α∞arguments␈α
two
␈↓ ↓H␈↓2.5.10␈α?␈α?␈α?␈α?␈α?␈α?␈α∀CONTROL STRUCTURES␈↓ 
aPage 51



␈↓ ↓H␈↓frames␈αand␈αa␈αvector.␈αMaxi␈αprocedures␈αdo␈αnot␈αhave␈αaccess␈αto␈αthe␈αactual␈αvariables␈αsent,␈αsince␈α
copies
␈↓ ↓H␈↓are made; therefore, all arguments to maxi procedures are considered to be VALUE parameters.

␈↓ ↓H␈↓It␈αis␈αpossible␈αto␈αdeclare␈αuntyped␈α(i.e.,␈αstatement-like,␈αinstead␈αof␈αexpression-like)␈αprocedures␈αas␈αwell.
␈↓ ↓H␈↓Replace␈α"maxi"␈αwith␈α"mini"␈αfor␈αprocedures␈αin␈αthe␈αmini.␈αSuch␈αprocedures␈αdo␈αhave␈αaccess␈αto␈α
values,
␈↓ ↓H␈↓and therefore parameters are not automatically considered to be VALUE.

␈↓ ↓H␈↓To achieve the second two cases, there exist ␈↓βinternal procedures␈↓ in 'AL:

␈↓ ↓H␈↓        INTERNAL FORCE VECTOR PROCEDURE baz (SCALAR s);

␈↓ ↓H␈↓Internal␈α∂procedures␈α∂must␈α∂be␈α∂at␈α∂the␈α∂top␈α∂level␈α∂of␈α∂an␈α∂'AL␈α∂program.␈α∂ A␈α∂complete␈α∂'AL␈α⊂program␈α∂is
␈↓ ↓H␈↓considered to be an untyped procedure without parameters.
␈↓ ↓H␈↓Page 52␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α	␈↓ H



␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α0␈↓∧CHAPTER 3␈↓
␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α!␈↓¬COMPILE-TIME CONSTRUCTS␈↓





␈↓ ↓H␈↓␈↓∧3.1 INTRODUCTION␈↓

␈↓ ↓H␈↓'AL␈αseeks␈αto␈αmaintain␈αa␈αfairly␈αaccurate␈αplanning␈α
model␈αof␈αthe␈αexpected␈αstate␈αfor␈αeach␈αpoint␈αin␈α
the
␈↓ ↓H␈↓execution␈αof␈αa␈αprogram.␈α This␈αplanning␈αmodel␈αincludes␈αthe␈αexpected␈αvalues␈αof␈αruntime␈αvariables,
␈↓ ↓H␈↓together␈αwith␈αa␈αnumber␈αof␈αsymbolic␈αassertions␈αabout␈αobjects,␈αrelations␈αbetween␈αframes,␈αconstraints
␈↓ ↓H␈↓on␈αtrajectory␈αendpoint␈αconditions,␈αand␈αother␈αinformation,␈αand␈αis␈αimportant␈αthroughout␈αthe␈α
system.
␈↓ ↓H␈↓At␈αthe␈αlowest␈α
level,␈αit␈αprovides␈α"target"␈α
locations␈αfor␈αthe␈α
calculation␈αof␈αproper␈αtrajectories.␈α
 Beyond
␈↓ ↓H␈↓this,␈αplanning␈αinformation␈αis␈α
used␈αto␈αdirect␈αconditional␈α
expansion␈αof␈αinput␈αprograms␈α
and␈αlibrary
␈↓ ↓H␈↓routines,␈αand␈αprovides␈αa␈αbasis␈αfor␈αdecisions␈αon␈αhow␈αto␈αtranslate␈αthe␈αvarious␈αhigh-level,␈αassembly-
␈↓ ↓H␈↓oriented constructs into runnable manipulation programs.

␈↓ ↓H␈↓A␈α
number␈α
of␈α
language␈α
constructs␈α
are␈α
provided␈α
in␈α'AL␈α
to␈α
allow␈α
the␈α
user␈α
to␈α
access␈α
this␈α
model␈αand␈α
to
␈↓ ↓H␈↓assist␈α∩in␈α∪maintaining␈α∩it.␈α∩ These␈α∪facilities␈α∩are␈α∪described␈α∩in␈α∩this␈α∪chapter,␈α∩which␈α∪also␈α∩discusses
␈↓ ↓H␈↓language␈αfeatures␈αsuch␈αas␈αconditional␈αcompilation␈αfor␈αincreasing␈αthe␈αconvenience␈αof␈αprogramming
␈↓ ↓H␈↓and␈α
the␈α
flexibility␈αof␈α
programs.␈α
 The␈α
use␈αof␈α
the␈α
planning␈αmodel␈α
facilities␈α
for␈α
object␈αdescriptions
␈↓ ↓H␈↓and by the "very high level" components of 'AL is discussed more fully in Chapter 4.





␈↓ ↓H␈↓␈↓∧3.2 PLANNING VALUES␈↓

␈↓ ↓H␈↓One␈α∂very␈α∂important␈α∂piece␈α∂of␈α∂information␈α∂about␈α∂a␈α∂variable␈α∂is␈α∂its␈α∂␈↓βplanning␈α∂value␈↓,␈α∂which␈α⊂is␈α∂the
␈↓ ↓H␈↓compiler's␈αestimate␈αof␈αwhat␈αvalue␈αthe␈αvariable␈αwill␈αhave␈αat␈αsome␈αpoint␈αin␈αthe␈αprogram␈αexecution.
␈↓ ↓H␈↓As␈α⊂with␈α⊂other␈α⊃aspects␈α⊂of␈α⊂the␈α⊂planning␈α⊃model,␈α⊂planning␈α⊂values␈α⊂have␈α⊃many␈α⊂uses␈α⊂in␈α⊃'AL.␈α⊂ One
␈↓ ↓H␈↓especially␈αimportant␈αuse␈αis␈αin␈αtrajectory␈αcalculation.␈α Although␈αprovisions␈αare␈αmade␈αto␈αmodify␈αany
␈↓ ↓H␈↓preplanned␈α⊂trajectory␈α⊃before␈α⊂executing␈α⊂it,␈α⊃the␈α⊂current␈α⊃scheme␈α⊂requires␈α⊂that␈α⊃at␈α⊂least␈α⊃a␈α⊂roughly
␈↓ ↓H␈↓accurate␈αvalue␈αbe␈αavailable␈αat␈αcompile␈αtime␈αif␈αsmooth␈αtrajectories␈αare␈αdesired.␈α This␈αwas␈αdiscussed
␈↓ ↓H␈↓in subsection 2.2.1.

␈↓ ↓H␈↓Typically,␈α
planning␈α
values␈α∞are␈α
updated␈α
whenever␈α
the␈α∞compiler␈α
encounters␈α
something␈α
that␈α∞it␈α
has
␈↓ ↓H␈↓reason to expect will cause the runtime value to change.  For instance, the assignment statement

␈↓ ↓H␈↓        foo ← 3

␈↓ ↓H␈↓will␈αcause␈αthe␈αcompiler␈αto␈αemit␈αcode␈αto␈αset␈αfoo␈αto␈α3␈αand␈αwill␈αcause␈αit␈αto␈αchange␈αthe␈αplanning␈αvalue
␈↓ ↓H␈↓of foo to become 3.  Similarly

␈↓ ↓H␈↓        a ← b + c
␈↓ ↓H␈↓3.2␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α∃PLANNING VALUES␈↓ 
aPage 53



␈↓ ↓H␈↓will␈αcause␈αthe␈αplanning␈αvalue␈αof␈αvariable␈α␈↓βa␈↓␈αto␈αbe␈αset␈αto␈αthe␈αplanning␈αvalue␈αof␈α␈↓βb␈↓␈αplus␈αthe␈αplanning
␈↓ ↓H␈↓value␈α∂of␈α∂␈↓βc␈↓,␈α∂provided␈α⊂that␈α∂both␈α∂␈↓βb␈↓␈α∂and␈α⊂␈↓βc␈↓␈α∂have␈α∂known␈α∂planning␈α⊂values.␈α∂ If␈α∂one␈α∂of␈α⊂the␈α∂planning
␈↓ ↓H␈↓values␈α∞isn't␈α∞known,␈α∂then␈α∞␈↓βa␈↓␈α∞gets␈α∞the␈α∂special␈α∞planning␈α∞value␈α∞␈↓βundefined␈↓,␈α∂which␈α∞is␈α∞also␈α∞used␈α∂as␈α∞an
␈↓ ↓H␈↓initial planning value at the time a variable is declared.

␈↓ ↓H␈↓Motion statements also can cause planning values to be updated.  For instance,

␈↓ ↓H␈↓        MOVE yellow TO bar

␈↓ ↓H␈↓will␈αcause␈αthe␈αplanning␈αvalue␈αof␈αyellow␈αto␈αbe␈αset␈αto␈αthe␈αplanning␈αvalue␈αof␈αbar.␈α Also,␈αthe␈α
planning
␈↓ ↓H␈↓value of any variables affixed to yellow will be updated appropriately.

␈↓ ↓H␈↓The planning value of a variable may be retrieved by use of the construct

␈↓ ↓H␈↓        #(<variable name>)

␈↓ ↓H␈↓which yields a constant equal to the planning value of the variable.  For example,

␈↓ ↓H␈↓        b ← 3;
␈↓ ↓H␈↓        a ← #(b);

␈↓ ↓H␈↓has the same effect as

␈↓ ↓H␈↓        b ← 3;
␈↓ ↓H␈↓        a ← 3;

␈↓ ↓H␈↓Although␈αthe␈αcompiler␈αmakes␈αan␈αeffort␈αto␈αkeep␈αtrack␈αof␈αthe␈αexpected␈αruntime␈αstate␈αof␈αvariables,␈αit
␈↓ ↓H␈↓must␈α∩sometimes␈α⊃be␈α∩given␈α⊃explicit␈α∩assistance.␈α⊃ For␈α∩example,␈α⊃it␈α∩is␈α⊃difficult␈α∩for␈α⊃the␈α∩compiler␈α⊃to
␈↓ ↓H␈↓maintain unambiguous planning values over conditional statements, as in this example:

␈↓ ↓H␈↓        SCALAR s1, s2;
␈↓ ↓H␈↓        VECTOR v1;
␈↓ ↓H␈↓        s1 ← 100;
␈↓ ↓H␈↓        IF s2 > 3 THEN
␈↓ ↓H␈↓                BEGIN
␈↓ ↓H␈↓                v1 ← VECTOR(1,2,3);
␈↓ ↓H␈↓                s1 ← 101;
␈↓ ↓H␈↓                {#(s1) = 101}
␈↓ ↓H␈↓                {#(v1) = VECTOR(1,2,3)}
␈↓ ↓H␈↓                END
␈↓ ↓H␈↓        ELSE
␈↓ ↓H␈↓                BEGIN
␈↓ ↓H␈↓                v1 ← VECTOR(1,2,4);
␈↓ ↓H␈↓                {#(v1) = VECTOR(1,2,4)}
␈↓ ↓H␈↓                {#(s1) = 100}
␈↓ ↓H␈↓                END;
␈↓ ↓H␈↓        {#(v1) = UNDEFINED}
␈↓ ↓H␈↓        {#(s1) = UNDEFINED}
␈↓ ↓H␈↓Page 54␈α?␈α?␈α?␈α?␈α?␈α?␈α,PLANNING VALUES␈↓ $3.2



␈↓ ↓H␈↓Although␈αthe␈α
compiler␈αmay␈αeventually␈α
be␈αsmart␈αenough␈α
to␈αresolve␈α
a␈αnumber␈αof␈α
such␈αcases,␈αfor␈α
the
␈↓ ↓H␈↓moment the user must tell the compiler what planning value to use thereafter.

␈↓ ↓H␈↓The compile-time assignment statement:

␈↓ ↓H␈↓        <variable> ←← <constant expression>

␈↓ ↓H␈↓is␈α
provided␈α∞to␈α
set␈α∞the␈α
planning␈α∞value␈α
of␈α∞a␈α
variable.␈α∞ Such␈α
assignments␈α∞affect␈α
only␈α∞the␈α
planning
␈↓ ↓H␈↓value; no code is emitted, and the runtime value of the variable remains unaffected.  Thus, both

␈↓ ↓H␈↓        v ← VECTOR(3,3,3)
␈↓ ↓H␈↓and
␈↓ ↓H␈↓        v ←← VECTOR(3,3,3)

␈↓ ↓H␈↓set␈α
the␈α
planning␈α
value␈α
of␈α
␈↓βv␈↓␈α
to␈α
VECTOR(3,3,3),␈αbut␈α
only␈α
the␈α
first␈α
form␈α
causes␈α
the␈α
runtime␈αvalue␈α
of
␈↓ ↓H␈↓␈↓βv␈↓ to be changed.

␈↓ ↓H␈↓Planning values provide a useful way to generate error estimates, as in

␈↓ ↓H␈↓        FRAME f1, f2, f3;
␈↓ ↓H␈↓        :
␈↓ ↓H␈↓        AFFIX f1 TO f2 RIGIDLY;
␈↓ ↓H␈↓        :
␈↓ ↓H␈↓        AFFIX yellow TO f2;
␈↓ ↓H␈↓        MOVE yellow TO f3;
␈↓ ↓H␈↓␈↓ βλ␈↓β{Moving␈α∃the␈α∃yellow␈α∃arm␈α∃will␈α∃cause␈α∃the␈α∃runtime␈α∃values␈α∃of␈α∃frames␈α∃f1␈α∃and␈α∃f2,
␈↓ ↓H␈↓β␈↓ βλwhich are affixed to it, to be updated as well.}
␈↓ ↓H␈↓        WHILE ABS(LOC(f1)-LOC(#(f1))) > .25*CM DO
␈↓ ↓H␈↓                BEGIN
␈↓ ↓H␈↓                :
␈↓ ↓H␈↓                {␈↓βMake a correction␈↓}
␈↓ ↓H␈↓                {␈↓βMeasure f1␈↓}
␈↓ ↓H␈↓                :
␈↓ ↓H␈↓                END;

␈↓ ↓H␈↓Although␈αit␈α
is␈αtheoretically␈α
possible␈αfor␈α
the␈αuser␈αto␈α
fill␈αin␈α
the␈αrelevant␈α
nominal␈αvalues␈αexplicitly,␈α
in
␈↓ ↓H␈↓practice␈α∞this␈α∞can␈α∞be␈α∂rather␈α∞inconvenient,␈α∞especially␈α∞when␈α∂the␈α∞planning␈α∞values␈α∞are␈α∂derived␈α∞from
␈↓ ↓H␈↓some␈αcomplicated␈αcomputation.␈α Furthermore,␈αthe␈α
availability␈αof␈αplanning␈αvalues␈αoffers␈α
significant
␈↓ ↓H␈↓advantages␈α
with␈αregard␈α
to␈αprogram␈α
flexibility,␈αsince␈α
changing␈αa␈α
particular␈αexpected␈α
value␈αwill␈α
not,
␈↓ ↓H␈↓in general, require substantial changes in program text.
␈↓ ↓H␈↓3.3␈α?␈α?␈α?␈α?␈α?␈α?␈α:PLANNING VARIABLES␈↓ 
aPage 55



␈↓ ↓H␈↓␈↓∧3.3 PLANNING VARIABLES␈↓

␈↓ ↓H␈↓Planning␈α∀variables␈α∪allow␈α∀the␈α∪user␈α∀to␈α∪take␈α∀advantage␈α∪of␈α∀the␈α∪compile-time␈α∀computation␈α∪and
␈↓ ↓H␈↓planning␈α
value␈α
maintenance␈α
facilities␈α
of␈α∞'AL␈α
without␈α
incurring␈α
the␈α
runtime␈α
overhead␈α∞of␈α
having
␈↓ ↓H␈↓regular␈α∞variables␈α∞in␈α∞cases␈α
where␈α∞only␈α∞their␈α∞planning␈α∞values␈α
are␈α∞ever␈α∞used.␈α∞Typical␈α∞uses␈α
include
␈↓ ↓H␈↓attaching␈α∂symbolic␈α∂names␈α∂to␈α∂constants,␈α∞use␈α∂of␈α∂temporary␈α∂variables␈α∂in␈α∂compile-time␈α∞calculations,
␈↓ ↓H␈↓object␈α∞modelling,␈α∞access␈α
to␈α∞symbolic␈α∞assertions␈α
in␈α∞the␈α∞planning␈α
model,␈α∞passing␈α∞"advice"␈α∞to␈α
high-
␈↓ ↓H␈↓level language primitives and to library routines.



␈↓ ↓H␈↓␈↓β3.3.1 ALGEBRAIC PLANNING VARIABLES␈↓

␈↓ ↓H␈↓Algebraic planning variables are declared by the construct

␈↓ ↓H␈↓        PLANNING <data-type> <identifier 1>, ... , <identifier n>   .

␈↓ ↓H␈↓For instance,

␈↓ ↓H␈↓        PLANNING SCALAR a, b, c;
␈↓ ↓H␈↓        PLANNING DISTANCE SCALAR d1, d1;
␈↓ ↓H␈↓        PLANNING FORCE VECTOR f1, f2, lift;
␈↓ ↓H␈↓        PLANNING TRANS t;

␈↓ ↓H␈↓Such␈α⊃variables␈α⊃may␈α∩have␈α⊃planning␈α⊃values,␈α⊃but␈α∩have␈α⊃no␈α⊃runtime␈α⊃existence␈α∩whatsoever.␈α⊃ This
␈↓ ↓H␈↓means␈α
that␈α
they␈α
may␈α
appear␈αon␈α
the␈α
left␈α
hand␈α
side␈αof␈α
planning␈α
assignment␈α
statements␈α
(i.e.,␈αthe␈α
"←←"
␈↓ ↓H␈↓form),␈αbut␈αnot␈αof␈αregular␈αassignment␈αstatements␈α(i.e.,␈αthe␈α"←"␈αform).␈α Similarly,␈αa␈αplanning␈αvariable
␈↓ ↓H␈↓may␈α
not␈α
appear␈α
in␈αan␈α
arithmetic␈α
expression,␈α
although␈α
its␈αplanning␈α
value␈α
(that␈α
is,␈α
#(<ct var>)␈α)␈α
may
␈↓ ↓H␈↓do so.  Thus, the following are legal:

␈↓ ↓H␈↓        PLANNING SIMPLE a, b;
␈↓ ↓H␈↓        SIMPLE v;

␈↓ ↓H␈↓        a ←← 3;
␈↓ ↓H␈↓        b ←← #(a) - .01;
␈↓ ↓H␈↓        v ← 2 + #(a);
␈↓ ↓H␈↓        v ← #(v) - v*#(b);
␈↓ ↓H␈↓        b ←← UNDEFINED; {␈↓βthis causes b to lose its planning value␈↓}

␈↓ ↓H␈↓These, however, are not legal:

␈↓ ↓H␈↓        PLANNING SIMPLE a, b;
␈↓ ↓H␈↓        SIMPLE v;

␈↓ ↓H␈↓        a ← 3;
␈↓ ↓H␈↓        v ← a; {␈↓βNote that no coercions to planning values are ever made.␈↓}
␈↓ ↓H␈↓        b ← a; {␈↓βDitto␈↓}
␈↓ ↓H␈↓        v ← UNDEFINED; {␈↓βUNDEFINED has no runtime meaning.␈↓}
␈↓ ↓H␈↓Page 56␈α?␈α?␈α?␈α?␈α?␈α?␈α∩PLANNING VARIABLES␈↓ ∂3.3.2



␈↓ ↓H␈↓␈↓β3.3.2 ATOMS␈↓

␈↓ ↓H␈↓In␈α∞addition␈α
to␈α∞the␈α
regular␈α∞runtime␈α
data␈α∞types,␈α
there␈α∞are␈α
several␈α∞additional␈α
types␈α∞that␈α
(presently)
␈↓ ↓H␈↓can␈α∪occur␈α∪only␈α∪with␈α∪planning␈α∪variables.␈α∪ These␈α∪variables␈α∪follow␈α∪the␈α∪usual␈α∪rules␈α∪concerning
␈↓ ↓H␈↓planning␈α∀value␈α∪assignment␈α∀and␈α∪propagation,␈α∀except␈α∀that␈α∪their␈α∀"value"␈α∪is␈α∀not␈α∀an␈α∪arithmetic
␈↓ ↓H␈↓quantity.␈α⊃ Instead,␈α⊃it␈α⊃is␈α⊃the␈α⊃internal␈α⊃structure␈α⊃associated␈α⊃with␈α⊃some␈α⊃construct␈α⊃in␈α⊃the␈α⊂language.
␈↓ ↓H␈↓Perhaps␈α∩the␈α∩most␈α⊃important␈α∩of␈α∩these␈α∩variable␈α⊃types␈α∩is␈α∩the␈α∩␈↓βatom␈↓,␈α⊃which␈α∩is␈α∩a␈α∩variable␈α⊃whose
␈↓ ↓H␈↓(planning) value is the name of another variable.  Atoms are declared by the construct

␈↓ ↓H␈↓        ATOM <id1>, ... , <idn>;

␈↓ ↓H␈↓Note␈α∞that␈α∞the␈α∞word␈α∞"PLANNING"␈α
is␈α∞not␈α∞needed,␈α∞since␈α∞an␈α
atom␈α∞is␈α∞purely␈α∞a␈α∞planning␈α
construct.
␈↓ ↓H␈↓Planning values may be assigned to atom variables by use of the construct

␈↓ ↓H␈↓        <atom name> ←← <variable name>
␈↓ ↓H␈↓as in

␈↓ ↓H␈↓        ATOM a1, a2, a3;
␈↓ ↓H␈↓        DISTANCE SCALAR d;

␈↓ ↓H␈↓        a1 ←← d;
␈↓ ↓H␈↓        a2 ←← a3;
␈↓ ↓H␈↓        #(a2) ←← #(a1);
␈↓ ↓H␈↓␈↓ βλ␈↓β{Now, #(a1)="d", #(a2)="a3", #(a3)="d"}

␈↓ ↓H␈↓Notice␈αthat␈α#(<atom>)␈α
yields␈αthe␈αname␈αof␈α
a␈αvariable;␈αits␈α
effect␈αis␈αas␈αif␈α
the␈αvariable␈αitself␈αwere␈α
used.
␈↓ ↓H␈↓Thus,

␈↓ ↓H␈↓        d ← 100*feet
␈↓ ↓H␈↓and

␈↓ ↓H␈↓        #(a1) ← 100*feet

␈↓ ↓H␈↓will␈α∞both␈α∞have␈α∞the␈α
same␈α∞effect.␈α∞ Also,␈α∞note␈α
that␈α∞assignment␈α∞to␈α∞an␈α
atom␈α∞constitutes␈α∞the␈α∞only␈α
case
␈↓ ↓H␈↓where␈α⊂the␈α⊂name␈α⊂of␈α⊂a␈α⊂variable␈α⊂may␈α⊂appear␈α⊂on␈α⊂the␈α⊂right␈α⊂hand␈α⊂side␈α⊂of␈α⊂a␈α⊂planning␈α⊂assignment
␈↓ ↓H␈↓statement.

␈↓ ↓H␈↓Atoms␈α
serve␈α
a␈α
number␈α
of␈α
useful␈α
purposes,␈αthe␈α
most␈α
prominent␈α
of␈α
which␈α
include␈α
serving␈α
as␈α"key
␈↓ ↓H␈↓words"␈α⊂in␈α∂symbolic␈α⊂assertions,␈α⊂providing␈α∂a␈α⊂means␈α∂for␈α⊂retrieving␈α⊂and␈α∂using␈α⊂variables␈α⊂as␈α∂object
␈↓ ↓H␈↓properties,␈α⊂and␈α∂as␈α⊂a␈α∂means␈α⊂for␈α∂adapting␈α⊂the␈α∂same␈α⊂piece␈α∂of␈α⊂program␈α∂text␈α⊂to␈α⊂perform␈α∂different
␈↓ ↓H␈↓versions of the same task.  For instance,
␈↓ ↓H␈↓3.3.2␈α?␈α?␈α?␈α?␈α?␈α?␈α*PLANNING VARIABLES␈↓ 
aPage 57



␈↓ ↓H␈↓        ATOM arm, h;
␈↓ ↓H␈↓        FRAME hole1,hole2;
␈↓ ↓H␈↓        :
␈↓ ↓H␈↓        arm ←← blue;
␈↓ ↓H␈↓        h ←← hole1;
␈↓ ↓H␈↓        :
␈↓ ↓H␈↓        MOVE #(arm) TO #(h);
␈↓ ↓H␈↓        :
␈↓ ↓H␈↓        h ←← hole2;
␈↓ ↓H␈↓        :
␈↓ ↓H␈↓        MOVE #(arm) TO #(h);
␈↓ ↓H␈↓        :

␈↓ ↓H␈↓Here,␈α∞the␈α∂MOVE␈α∞statement␈α∂has␈α∞been␈α∂typed␈α∞out␈α∞twice,␈α∂so␈α∞the␈α∂actual␈α∞saving␈α∂is␈α∞rather␈α∂small.␈α∞ In
␈↓ ↓H␈↓practice,␈α∞however,␈α∂it␈α∞is␈α∂common␈α∞to␈α∞place␈α∂such␈α∞statements␈α∂inside␈α∞a␈α∞macro␈α∂or␈α∞library␈α∂routine␈α∞(see
␈↓ ↓H␈↓Section␈α⊃3.7),␈α⊂in␈α⊃which␈α⊂case␈α⊃the␈α⊂gain␈α⊃in␈α⊂convenience␈α⊃can␈α⊂be␈α⊃appreciable.␈α⊂ Similarly,␈α⊃the␈α⊂atoms
␈↓ ↓H␈↓"arm"␈α⊂and␈α∂"h"␈α⊂can␈α⊂be␈α∂given␈α⊂planning␈α⊂values␈α∂by␈α⊂means␈α∂of␈α⊂the␈α⊂BIND␈α∂construct␈α⊂in␈α⊂a␈α∂planning
␈↓ ↓H␈↓conditional expansion (see Section 3.5).



␈↓ ↓H␈↓␈↓β3.3.3 EXPRESSIONS, CLAUSES, STATEMENTS, AND FORMS␈↓

␈↓ ↓H␈↓Another␈α⊂very␈α∂important␈α⊂type␈α⊂is␈α∂the␈α⊂␈↓βexpression␈↓,␈α⊂which␈α∂takes␈α⊂as␈α⊂its␈α∂planning␈α⊂value␈α⊂the␈α∂internal
␈↓ ↓H␈↓structure␈α⊂associated␈α⊂with␈α⊂an␈α⊂expression␈α⊂in␈α⊂the␈α⊂language.␈α⊂ These␈α⊂variables␈α⊂are␈α⊂declared␈α⊂by␈α∂the
␈↓ ↓H␈↓construct

␈↓ ↓H␈↓        EXPRESSION <id1>, ... ,<idn>;

␈↓ ↓H␈↓Again,␈αnote␈αthat␈αthe␈αword␈α"PLANNING"␈αis␈αnot␈αused.␈α If␈αdesired,␈αan␈αatom␈αor␈αexpression␈αvariable
␈↓ ↓H␈↓may␈α⊂be␈α⊂restricted␈α⊃to␈α⊂values␈α⊂of␈α⊃some␈α⊂particular␈α⊂algebraic␈α⊂type␈α⊃by␈α⊂inclusion␈α⊂of␈α⊃the␈α⊂appropriate
␈↓ ↓H␈↓additional declarators.  For instance,

␈↓ ↓H␈↓        DISTANCE ATOM da;
␈↓ ↓H␈↓        VECTOR ATOM va;
␈↓ ↓H␈↓        FORCE VECTOR ATOM fva;
␈↓ ↓H␈↓        TRANS EXPRESSION te1, te2;


␈↓ ↓H␈↓Other␈αplanning␈αonly␈αtypes␈αinclude␈α␈↓βstatement,␈αclause,␈↓,␈αand␈α␈↓βform␈↓.␈α Statement␈αvariables␈αtake␈αas␈αtheir
␈↓ ↓H␈↓planning␈αvalues␈αthe␈αinternal␈αstructure␈αassociated␈αwith␈αa␈αstatement.␈α Clause␈αvariables␈αtake␈αas␈αtheir
␈↓ ↓H␈↓planning␈α+values␈α*the␈α+structure␈α*associated␈α+with␈α*clauses,␈α+such␈α*as␈α+"TO ⊗"␈α*and
␈↓ ↓H␈↓"WITH DURATION ≥ 3*SEC".␈α∂ Clauses,␈α⊂statements␈α∂and␈α∂expressions␈α⊂are␈α∂primarily␈α∂useful␈α⊂as␈α∂a
␈↓ ↓H␈↓means␈α∞of␈α∞passing␈α∞explicit␈α
"advice"␈α∞on␈α∞to␈α∞a␈α∞library␈α
routine␈α∞or␈α∞high-level␈α∞primitive.␈α∞ In␈α
addition,
␈↓ ↓H␈↓statement variables are frequently very useful as placeholders in partially written code.

␈↓ ↓H␈↓␈↓βForm␈↓␈αvariables␈α
hold␈αreferences␈α
to␈αassertions␈αin␈α
the␈αcompiler's␈α
planning␈αmodel␈α
and␈αare␈αdiscussed␈α
in
␈↓ ↓H␈↓more␈α⊂detail␈α⊂in␈α⊂subsequent␈α⊂sections.␈α∂ One␈α⊂use␈α⊂is␈α⊂to␈α⊂allow␈α⊂a␈α∂user␈α⊂to␈α⊂remember␈α⊂the␈α⊂name␈α⊂of␈α∂an
␈↓ ↓H␈↓assertion in such a way as to facilitate undoing it later.
␈↓ ↓H␈↓Page 58␈α?␈α?␈α?␈α?␈α?␈α?␈α∩PLANNING VARIABLES␈↓ ∂3.3.3



␈↓ ↓H␈↓Planning␈α
values␈α
may␈α
be␈α
assigned␈α
to␈α
clause,␈α
statement,␈α
expression,␈α
and␈α
form␈α
variables␈α
by␈α
use␈αof␈α
the
␈↓ ↓H␈↓appropriate␈αconstruction␈αfunctions␈αto␈αproduce␈αconstants␈αof␈αthe␈αappropriate␈αtypes.␈α Thus␈αwe␈αmight
␈↓ ↓H␈↓have:

␈↓ ↓H␈↓        TRANS t1;
␈↓ ↓H␈↓        FRAME widget;
␈↓ ↓H␈↓        ATOM height;
␈↓ ↓H␈↓        CLAUSE c;
␈↓ ↓H␈↓        EXPRESSION e;
␈↓ ↓H␈↓        STATEMENT s;
␈↓ ↓H␈↓        FORM f;
␈↓ ↓H␈↓        :
␈↓ ↓H␈↓        f ←← FORM(height, widget, 100);
␈↓ ↓H␈↓        e ←← EXPRESSION(t1*ypark);
␈↓ ↓H␈↓        s ←← STATEMENT(MOVE YELLOW TO #(e));
␈↓ ↓H␈↓        c ←← CLAUSE(VIA widget);
␈↓ ↓H␈↓␈↓ βλ␈↓β{Note␈α∀that␈α∀#(e)␈α∀will␈α∀not␈α∀be␈α∀evaluated␈α∀until␈α∀the␈α∀planning␈α∀value␈α∀of␈α∀s␈α∀is␈α∪used;
␈↓ ↓H␈↓β␈↓ βλthat is, until #(s) is used as a statement somewhere}

␈↓ ↓H␈↓As␈α
one␈α
might␈α
expect,␈α
the␈α
argument␈α
to␈αan␈α
␈↓βexpression␈↓␈α
primitive␈α
is␈α
an␈α
expression,␈α
the␈α
argument␈αto
␈↓ ↓H␈↓␈↓βclause␈↓␈αis␈αa␈αclause,␈αand␈αand␈αthe␈αargument␈αto␈αa␈α␈↓βstatement␈↓␈αprimitive␈αis␈αa␈αstatement.␈α These␈αcompile-
␈↓ ↓H␈↓time␈α
functions␈α
return␈α
the␈α
internal␈α
structures␈αassociated␈α
with␈α
their␈α
arguments;␈α
when␈α
this␈αstructure␈α
is
␈↓ ↓H␈↓stored␈αinto␈αa␈αplanning␈αvariable␈αof␈αthe␈α
appropriate␈αtype␈αthen␈αthe␈αplanning␈αvalue␈αof␈α
that␈αvariable
␈↓ ↓H␈↓becomes the expression or statement.  Thus,

␈↓ ↓H␈↓        e ←← EXPRESSION(t1*t2*f1);
␈↓ ↓H␈↓        c ←← CLAUSE(VIA widget);
␈↓ ↓H␈↓        s ←← STATEMENT(MOVE YELLOW TO f3  (c));
␈↓ ↓H␈↓        :
␈↓ ↓H␈↓        f3 ← #(e)
␈↓ ↓H␈↓        #(s);
␈↓ ↓H␈↓and
␈↓ ↓H␈↓        f3 ← t1*t2*f1;
␈↓ ↓H␈↓        MOVE yellow TO f3 VIA widget;

␈↓ ↓H␈↓will have exactly the same effect.





␈↓ ↓H␈↓␈↓∧3.4 ASSERTIONS␈↓

␈↓ ↓H␈↓In␈αaddition␈αto␈αplanning␈αvalues,␈α
the␈αplanning␈αmodel␈αused␈αby␈α
'AL␈αincludes␈αa␈αnumber␈αof␈α
facts␈αthat
␈↓ ↓H␈↓are␈α∂usefully␈α∂expressed␈α⊂as␈α∂symbolic␈α∂assertions.␈α∂ These␈α⊂facts␈α∂include␈α∂object␈α⊂descriptions,␈α∂semantic
␈↓ ↓H␈↓information␈α∀about␈α∃what␈α∀is␈α∃in␈α∀the␈α∀hands,␈α∃state␈α∀information␈α∃about␈α∀required␈α∃approaches␈α∀for
␈↓ ↓H␈↓motions,and␈αrelations␈αbetween␈αframes.␈α Internally,␈αall␈αfacts␈α(whether␈αadded␈αto␈αthe␈αdata␈αbase␈αby␈α
the
␈↓ ↓H␈↓compiler␈α
or␈α
explicitly␈αby␈α
the␈α
user)␈αare␈α
represented␈α
as␈αforms␈α
of␈α
constant␈αelements␈α
such␈α
as␈αone␈α
might
␈↓ ↓H␈↓find as planning values for some variable or another.  For example,
␈↓ ↓H␈↓3.4␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈αASSERTIONS␈↓ 
aPage 59



␈↓ ↓H␈↓        FORM(Roses, are, red);
␈↓ ↓H␈↓        FORM(WEIGHT, engine_block, 3.5*POUNDS);
␈↓ ↓H␈↓        FORM(AFFIXED, f1, TO, f2, BY, t3, RIGIDLY);
␈↓ ↓H␈↓        FORM(v1, COMPUTED_BY, EXPRESSION(a*v2+v3) );

␈↓ ↓H␈↓are typical of the sort of forms which one might have in the data base.

␈↓ ↓H␈↓Readers␈α∃familiar␈α∀with␈α∃recent␈α∀research␈α∃in␈α∃artificial␈α∀intelligence␈α∃will␈α∀no␈α∃doubt␈α∃recognise␈α∀the
␈↓ ↓H␈↓similarity␈αof␈αmany␈αof␈αthe␈αconstructs␈αpresented␈αin␈αthis␈αsection␈αwith␈αcomparable␈αfeatures␈αin␈αmodern
␈↓ ↓H␈↓AI␈α∞languages.␈α∞ A␈α∞detailed␈α∞discussion␈α∞of␈α∞this␈α∞relation␈α∞or␈α∞of␈α∞implementation␈α∞details␈α∞is␈α∞beyond␈α
the
␈↓ ↓H␈↓scope␈α∀of␈α∀this␈α∀paper.␈α∀ However,␈α∀perhaps␈α∀it␈α∪should␈α∀be␈α∀pointed␈α∀out␈α∀again␈α∀that␈α∀the␈α∪assertion
␈↓ ↓H␈↓mechanisms␈α⊂in␈α⊂'AL␈α∂are␈α⊂a␈α⊂planning-time␈α∂construct␈α⊂without␈α⊂any␈α∂runtime␈α⊂existence.␈α⊂ The␈α∂system
␈↓ ↓H␈↓attempts␈α∂to␈α∂keep␈α∂track␈α∂of␈α∂what␈α∞facts␈α∂are␈α∂expected␈α∂to␈α∂be␈α∂true␈α∞at␈α∂each␈α∂point␈α∂in␈α∂the␈α∂program␈α∞by
␈↓ ↓H␈↓associating␈α
with␈α
each␈α
fact␈α
in␈α
the␈α
data␈α
base␈α
a␈α
set␈α
of␈α
"worlds"␈α
corresponding␈α
to␈α
each␈α
place␈α
that␈α
a␈α
fact
␈↓ ↓H␈↓is true.  Some further discussion of this mechanism may be found in Section 4.5.



␈↓ ↓H␈↓␈↓β3.4.1 THE ASSERT STATEMENT␈↓

␈↓ ↓H␈↓Symbolic assertions may be added to the data base by use of the statement

␈↓ ↓H␈↓        ASSERT <form>

␈↓ ↓H␈↓where␈α∪<form>␈α∩is␈α∪either␈α∩the␈α∪planning␈α∩value␈α∪of␈α∩a␈α∪FORM␈α∩variable␈α∪or␈α∩a␈α∪call␈α∩on␈α∪the␈α∩FORM
␈↓ ↓H␈↓construction primitive,

␈↓ ↓H␈↓        FORM(<element 1>,<element 2>, ... ,<element n>)

␈↓ ↓H␈↓In␈α⊃general,␈α⊃each␈α⊂<element>␈α⊃must␈α⊃be␈α⊂something␈α⊃that␈α⊃can␈α⊂appear␈α⊃on␈α⊃the␈α⊂right␈α⊃hand␈α⊃side␈α⊃of␈α⊂a
␈↓ ↓H␈↓planning␈α⊂assignment␈α⊂statement␈α⊂(i.e.,␈α⊂the␈α∂"←←"␈α⊂assignment).␈α⊂ This␈α⊂includes␈α⊂constants,␈α∂expressions
␈↓ ↓H␈↓involving␈αonly␈αconstants␈α(including␈α
#(<variable>)␈α),␈αvariable␈αnames,␈α
and␈αthe␈αresults␈αof␈α
construction
␈↓ ↓H␈↓functions␈α
like␈α
EXPRESSION,␈αSTATEMENT,␈α
and␈α
FORM.␈α
 (Also,␈αthe␈α
BIND␈α
construct␈αis␈α
allowed,
␈↓ ↓H␈↓but this is discussed later).  For instance,

␈↓ ↓H␈↓        ATOM holds, SLOT, headtype1, HEX, now, is, the, time;
␈↓ ↓H␈↓␈↓ βλ␈↓β{We␈α∪are␈α∪following␈α∩a␈α∪convention␈α∪that␈α∩␈↓individuals␈↓β␈α∪are␈α∪in␈α∩lower␈α∪case,␈α∪and␈α∩␈↓classes
␈↓ ↓H␈↓␈↓ βλor properties␈↓β are in upper case.}
␈↓ ↓H␈↓        STATEMENT PARKING_METHOD;
␈↓ ↓H␈↓        FRAME driver1;
␈↓ ↓H␈↓        FORM formvar;
␈↓ ↓H␈↓        :
␈↓ ↓H␈↓        ASSERT FORM(yellow, holds, driver1);
␈↓ ↓H␈↓        ASSERT FORM(SLOT, headtype1, HEX, 0.53);
␈↓ ↓H␈↓        ASSERT FORM(PARKING_METHOD, yellow,
␈↓ ↓H␈↓                        STATEMENT(MOVE YELLOW TO YPARK));
␈↓ ↓H␈↓        formvar ←← FORM(now, is, the, time);
␈↓ ↓H␈↓        ASSERT #(formvar)
␈↓ ↓H␈↓Page 60␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α#ASSERTIONS␈↓ ∂3.4.1



␈↓ ↓H␈↓The␈α
actual␈α
meaning␈α
of␈α
an␈α
asserted␈α
pattern␈α
is␈α
generally␈α
determined␈α
by␈α
whatever␈α
conventions␈α
the
␈↓ ↓H␈↓user␈α
may␈α
wish␈α∞to␈α
establish.␈α
 However,␈α∞a␈α
few␈α
pattern␈α∞types,␈α
such␈α
as␈α∞those␈α
for␈α
affixment␈α∞or␈α
those
␈↓ ↓H␈↓used␈α∞by␈α∂the␈α∞very␈α∂high␈α∞level␈α∂routines␈α∞for␈α∂object␈α∞descriptions,␈α∂are␈α∞"understood"␈α∂and␈α∞used␈α∂by␈α∞the
␈↓ ↓H␈↓compiler.␈α (As␈αmentioned␈αearlier,␈α'AL␈αincludes␈αa␈αnumber␈αof␈αpredeclared␈αatoms␈αto␈αact␈αas␈αkey␈αwords
␈↓ ↓H␈↓in␈α∞these␈α∂reserved␈α∞patterns.)␈α∞The␈α∂user␈α∞can␈α∂cause␈α∞serious␈α∞confusions␈α∂by␈α∞improper␈α∂introduction␈α∞or
␈↓ ↓H␈↓deletion␈α
of␈α
such␈αpatterns,␈α
although,␈α
used␈αproperly,␈α
they␈α
provide␈αa␈α
valuable␈α
tool␈αfor␈α
communication
␈↓ ↓H␈↓with the planning model.



␈↓ ↓H␈↓␈↓β3.4.2 THE DENY STATEMENT␈↓

␈↓ ↓H␈↓Generally,␈αassertions␈αwill␈α
remain␈α"true"␈αin␈αthe␈α
compiler's␈αworld␈αmodel␈α
until␈αexplicitly␈αdeleted␈αor,␈α
in
␈↓ ↓H␈↓the␈α∞case␈α∞of␈α∞assertions␈α∞used␈α∞by␈α∞the␈α∞compiler,␈α∞as␈α∞a␈α∞side␈α∞effect␈α∞of␈α∞processing␈α∞some␈α∂statement.␈α∞ Any
␈↓ ↓H␈↓assertion may be undone by use of the DENY construct, which is similar to ASSERT:

␈↓ ↓H␈↓        DENY FORM(IN, HAND, screwdriver);
␈↓ ↓H␈↓        DENY #(formvar);




␈↓ ↓H␈↓␈↓β3.4.3 CONSTRAINT ASSERTIONS␈↓

␈↓ ↓H␈↓In␈αaddition␈αto␈αplanning␈α
values␈αand␈αsymbolic␈αassertions,␈α
the␈αsystem's␈αplanning␈αmodel␈α
may␈αinclude
␈↓ ↓H␈↓constraint␈αinformation␈αdelimiting␈αthe␈αrange␈αof␈αvalues␈αthat␈αa␈αvariable␈αmay␈αtake␈αon.␈α Much␈αof␈αthis
␈↓ ↓H␈↓information␈αis␈αexpressed␈αinternally␈αby␈αmeans␈αof␈αmathematical␈αconstraints␈αon␈αscalar␈αvariables␈αthat
␈↓ ↓H␈↓represent␈α
degrees␈α
of␈αfreedom␈α
in␈α
object␈αlocations.␈α
For␈α
instance,␈α
if␈αa␈α
flat␈α
surface␈αof␈α
an␈α
object␈αis␈α
flush
␈↓ ↓H␈↓up␈αagainst␈αanother␈αflat␈αsurface,␈αthen␈α(in␈αthe␈αabsence␈αof␈αother␈αconstraints)␈αthe␈αobject␈αwill␈αhave␈αtwo
␈↓ ↓H␈↓translational␈αand␈αone␈αrotational␈αdegrees␈αof␈αfreedom.␈α These␈αconstraints␈αare␈αgenerally␈αderived␈α
from
␈↓ ↓H␈↓the␈α
semantics␈α
of␈α
the␈α
various␈α
"high␈α
level"␈α
operations,␈α
the␈α
object␈α
descriptions,␈α
and␈αcertain␈α
"standard"
␈↓ ↓H␈↓assertional␈α∞patterns.␈α∞(See␈α∞Section␈α∞4.6␈α
for␈α∞more␈α∞details.)␈α∞In␈α∞addition,␈α
however,␈α∞a␈α∞user␈α∞can␈α∞use␈α
the
␈↓ ↓H␈↓construct

␈↓ ↓H␈↓        ASSERT <expression><relation><constant>

␈↓ ↓H␈↓in␈αorder␈αto␈αstate␈αa␈αconstraint␈αrelationship␈αexplicitly.␈α The␈α<relation>␈αmay␈αbe␈αany␈αof␈α"≤","<","=",">",
␈↓ ↓H␈↓and␈α"≥".␈α At␈αpresent,␈α<expression>␈αis␈αrestricted␈αto␈αbe␈αa␈αlinear␈αform␈αinvolving␈αonly␈αscalar␈αvariables
␈↓ ↓H␈↓or the dot product of two vectors.  For instance,

␈↓ ↓H␈↓        DISTANCE SCALAR a, b, c;
␈↓ ↓H␈↓        VECTOR v;
␈↓ ↓H␈↓        :
␈↓ ↓H␈↓        ASSERT 3*a + 4*b - 2*c  ≤  2*INCHES;
␈↓ ↓H␈↓        ASSERT v . Z > 0.25;

␈↓ ↓H␈↓This␈α⊃construct␈α⊃is␈α⊃primarily␈α⊂intended␈α⊃for␈α⊃use␈α⊃in␈α⊃debugging␈α⊂the␈α⊃higher␈α⊃level␈α⊃operators␈α⊃and␈α⊂in
␈↓ ↓H␈↓writing␈αlibrary␈αroutines␈αthat␈αare␈αto␈αbe␈αused␈αwith␈αsuch␈αoperators.␈α It␈αis␈αbeing␈αdescribed␈αhere␈αin␈αthe
␈↓ ↓H␈↓interests of completeness and because reference is made to it in Section 4.6.
␈↓ ↓H␈↓3.4.4␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α;ASSERTIONS␈↓ 
aPage 61



␈↓ ↓H␈↓␈↓β3.4.4 STANDARD USES FOR ASSERTIONS␈↓

␈↓ ↓H␈↓The␈α∩user␈α∩may␈α∩use␈α∩the␈α∪assertional␈α∩database␈α∩to␈α∩store␈α∩arbitrary␈α∩information.␈α∪ Certain␈α∩patterns,
␈↓ ↓H␈↓however,␈α∂are␈α∞given␈α∂special␈α∞meaning␈α∂in␈α∞'AL.␈α∂ For␈α∞example,␈α∂in␈α∞our␈α∂discussion␈α∞of␈α∂deproaches,␈α∞we
␈↓ ↓H␈↓implied␈αthat␈αthe␈αcompiler␈αkeeps␈αtrack␈αof␈αeach␈αframe's␈αassociated␈αdeproach␈αby␈αmeans␈αof␈αassertions.
␈↓ ↓H␈↓Thus, to give the frame f1 a deproach transformation t1, one writes:

␈↓ ↓H␈↓        ASSERT FORM(DEPROACH, f1, t1)   .

␈↓ ↓H␈↓Another standard use is for affixments.  One effect of the statement

␈↓ ↓H␈↓        AFFIX f1 TO f2

␈↓ ↓H␈↓is the assertion

␈↓ ↓H␈↓        ASSERT FORM(AFFIXED, f1, f2)    .

␈↓ ↓H␈↓Similarly,␈α
the␈α
object␈α
descriptions␈α
used␈α
by␈αthe␈α
assembly-oriented␈α
operations,␈α
as␈α
well␈α
as␈αthe␈α
planning
␈↓ ↓H␈↓model␈αassociated␈αwith␈αsuch␈αoperations,␈αrely␈αquite␈αstrongly␈αon␈αstandard␈αassertion␈αpatterns.␈α A␈α
fuller
␈↓ ↓H␈↓discussion␈α
of␈α
some␈αof␈α
these␈α
patterns␈αmay␈α
be␈α
found␈αin␈α
Section␈α
4.7.␈α However,␈α
this␈α
document␈αdoes
␈↓ ↓H␈↓not␈αpurport␈αto␈αlist␈αfully␈αall␈αthe␈αpatterns␈αthat␈αare␈αactually␈αused␈αby␈α'AL,␈αalthough␈αit␈αshould␈αgive␈αthe
␈↓ ↓H␈↓reader␈α
some␈α
idea␈α
of␈α
their␈α
approximate␈α
extent␈αand␈α
should␈α
provide␈α
a␈α
fair␈α
indication␈α
of␈α
how␈αthey
␈↓ ↓H␈↓are actually used.





␈↓ ↓H␈↓␈↓∧3.5 CONDITIONAL EXPANSION␈↓

␈↓ ↓H␈↓It␈α∂is␈α∂frequently␈α∂desirable␈α∂to␈α∂write␈α∂a␈α∂fairly␈α∂general␈α∂piece␈α∂of␈α∂source␈α∂code␈α∂that␈α∂produces␈α∂different
␈↓ ↓H␈↓object␈α
code,␈α
depending␈α
on␈α
the␈α
specific␈α
task␈α
to␈α
be␈α
performed␈α
and␈α
on␈α
the␈α
compiler's␈α
model␈α∞of␈α
the
␈↓ ↓H␈↓expected runtime environment.



␈↓ ↓H␈↓␈↓β3.5.1 PLAN IF␈↓

␈↓ ↓H␈↓The␈αprincipal␈αmechanism␈αprovided␈αfor␈αthis␈αpurpose␈αis␈αthe␈αplan-time␈αconditional␈αconstruct,␈αwhich
␈↓ ↓H␈↓behaves␈α
like␈αa␈α
conventional␈α
Algol␈α"IF",␈α
except␈α
that␈αit␈α
is␈α
resolved␈αat␈α
compile␈α
time,␈αwith␈α
only␈αthe␈α
the
␈↓ ↓H␈↓"expanded" part having any effect on the compiler's world model.  The syntax is:

␈↓ ↓H␈↓        PLAN IF <condition> THEN
␈↓ ↓H␈↓                <then-part>
␈↓ ↓H␈↓        ELSE
␈↓ ↓H␈↓                <else-part>

␈↓ ↓H␈↓where␈α∂the␈α⊂"ELSE"␈α∂component␈α∂may␈α⊂be␈α∂omitted␈α∂if␈α⊂desired.␈α∂ The␈α∂condition␈α⊂may␈α∂be␈α⊂any␈α∂boolean
␈↓ ↓H␈↓expression which can be completely evaluated at plan-time.  For instance:
␈↓ ↓H␈↓Page 62␈α?␈α?␈α?␈α?␈α?␈α-CONDITIONAL EXPANSION␈↓ ∂3.5.1



␈↓ ↓H␈↓        PLAN IF #(blue) ≠ bpark THEN
␈↓ ↓H␈↓                MOVE blue TO bpark;

␈↓ ↓H␈↓which␈α
says␈α
that␈α
if␈α
the␈α
planning␈α
value␈α
of␈α
the␈α∞blue␈α
arm␈α
is␈α
not␈α
equal␈α
to␈α
bpark␈α
(that␈α
is,␈α
if␈α∞the␈α
last
␈↓ ↓H␈↓motion␈αstatement␈αfor␈αthe␈α
blue␈αarm␈αwas␈αnot␈α
to␈αits␈αparked␈αposition),␈α
then␈αinsert␈αa␈αstatement␈αto␈α
move
␈↓ ↓H␈↓it␈α⊃there.␈α⊃ Similarly,␈α⊃suppose␈α⊃we␈α⊃have␈α⊃a␈α⊃general␈α⊃routine␈α⊃for␈α⊃putting␈α⊃screws␈α⊃in␈α⊃holes.␈α⊃ Further,
␈↓ ↓H␈↓assume␈α⊂that␈α∂we␈α⊂are␈α∂using␈α⊂a␈α∂plan-time␈α⊂variable␈α∂"chamfer"␈α⊂to␈α∂contain␈α⊂the␈α∂width␈α⊂of␈α∂chamfering
␈↓ ↓H␈↓around the hole.  Then the routine might have something like:

␈↓ ↓H␈↓        PLAN IF #(chamfer) > .25*INCHES THEN
␈↓ ↓H␈↓                BEGIN
␈↓ ↓H␈↓␈↓ βH␈↓β{Code to perform a simple "straight in" insertion}
␈↓ ↓H␈↓                END
␈↓ ↓H␈↓        ELSE
␈↓ ↓H␈↓                BEGIN
␈↓ ↓H␈↓␈↓ βH␈↓β{Code to perform some sort of a search to get the screw into the hole}
␈↓ ↓H␈↓                END;





␈↓ ↓H␈↓␈↓β3.5.2 TESTING FOR ASSERTIONS␈↓

␈↓ ↓H␈↓The␈α
presence␈α
in␈αthe␈α
data␈α
base␈αof␈α
a␈α
symbolic␈αform␈α
can␈α
be␈αtested␈α
by␈α
use␈αof␈α
the␈α
␈↓βasserted␈↓␈αconstruct,␈α
as
␈↓ ↓H␈↓in

␈↓ ↓H␈↓        PLAN IF ASSERTED(FORM(IN,TOOLRACK,SCREWDRIVER)) THEN
␈↓ ↓H␈↓                BEGIN
␈↓ ↓H␈↓␈↓ βH␈↓β{Code to fetch the screwdriver out of the tool rack}
␈↓ ↓H␈↓                END;
␈↓ ↓H␈↓In general,

␈↓ ↓H␈↓        ASSERTED(<form>)

␈↓ ↓H␈↓returns␈α"true"␈αwhenever␈αthe␈α<form>␈αis␈αasserted␈αin␈αthe␈αplanning␈αmodel␈αat␈αthe␈αpoint␈αthat␈αthe␈αtest␈αis
␈↓ ↓H␈↓made.  Thus,
␈↓ ↓H␈↓3.5.2␈α?␈α?␈α?␈α?␈α?␈α?␈αεCONDITIONAL EXPANSION␈↓ 
aPage 63



␈↓ ↓H␈↓        FORM f;
␈↓ ↓H␈↓        TIME t;
␈↓ ↓H␈↓        :
␈↓ ↓H␈↓        PLAN IF ASSERTED( (f)) THEN
␈↓ ↓H␈↓                BEGIN
␈↓ ↓H␈↓                t←3*SEC;
␈↓ ↓H␈↓                DENY  (f);
␈↓ ↓H␈↓                END;
␈↓ ↓H␈↓        PLAN IF ASSERTED( (f)) THEN
␈↓ ↓H␈↓                BEGIN
␈↓ ↓H␈↓                t←4*SEC;
␈↓ ↓H␈↓                END;
␈↓ ↓H␈↓        :
␈↓ ↓H␈↓would expand into

␈↓ ↓H␈↓        FORM f;
␈↓ ↓H␈↓        TIME t;
␈↓ ↓H␈↓        :
␈↓ ↓H␈↓        t←3*SEC;
␈↓ ↓H␈↓        DENY  (f);
␈↓ ↓H␈↓        :

␈↓ ↓H␈↓Furthermore,␈α∩note␈α∩that␈α⊃ASSERTED(<form>)␈α∩acts␈α∩like␈α⊃a␈α∩boolean␈α∩primary␈α⊃and␈α∩can␈α∩enter␈α⊃into
␈↓ ↓H␈↓boolean expressions in the usual way.  For instance,

␈↓ ↓H␈↓        PLAN IF ASSERTED(FORM(GOES_IN,shaft1,hole1))
␈↓ ↓H␈↓                        ∧¬ASSERTED(FORM,IN,shaft1,hole1)) THEN
␈↓ ↓H␈↓                BEGIN
␈↓ ↓H␈↓                PLAN IF ASSERTED(FORM(THREADED,shaft1)) THEN
␈↓ ↓H␈↓                        BEGIN
␈↓ ↓H␈↓␈↓ ∧λ␈↓β{code to insert a threaded screw}
␈↓ ↓H␈↓                        ASSERT FORM(SCREWED,shaft1);
␈↓ ↓H␈↓                        END
␈↓ ↓H␈↓                ELSE
␈↓ ↓H␈↓                        BEGIN
␈↓ ↓H␈↓␈↓ ∧λ␈↓β{code to insert a smooth pin}
␈↓ ↓H␈↓                        ASSERT FORM(SLIPPED_IN,shaft1);
␈↓ ↓H␈↓                        END;
␈↓ ↓H␈↓                ASSERT FORM(IN,shaft1,hole1);
␈↓ ↓H␈↓                END;
␈↓ ↓H␈↓Page 64␈α?␈α?␈α?␈α?␈α?␈α-CONDITIONAL EXPANSION␈↓ ∂3.5.3



␈↓ ↓H␈↓␈↓β3.5.3 THE ANYTHING CONSTRUCT␈↓

␈↓ ↓H␈↓Frequently,␈αone␈αmay␈αwant␈αto␈αtest␈αa␈αwhole␈αclass␈αof␈αasserted␈αforms␈αat␈αonce.␈αFor␈αinstance,␈αsuppose␈αwe
␈↓ ↓H␈↓may␈αwant␈αto␈αknow␈αif␈αthe␈αblue␈αhand␈αis␈αavailable␈αfor␈αsome␈αtask␈αor␈αanother.␈α We␈αcan␈αkeep␈αtrack␈αof
␈↓ ↓H␈↓what is in the hand by means of assertions like

␈↓ ↓H␈↓        ASSERT FORM(blue,HOLDS,widget);

␈↓ ↓H␈↓However,␈αit␈αis␈αfrequently␈αinconvenient,␈αand␈αsometimes␈αimpossible,␈αto␈αtest␈αall␈αpossibilities␈αexplicitly,
␈↓ ↓H␈↓as in:

␈↓ ↓H␈↓        PLAN IF ¬ASSERTED(FORM(BLUE,HOLDS,widget))
␈↓ ↓H␈↓            ∧ ¬ASSERTED(FORM(BLUE,HOLDS,frob)) ∧ . . .  THEN
␈↓ ↓H␈↓                        BEGIN
␈↓ ↓H␈↓                        {␈↓βwhatever␈↓}
␈↓ ↓H␈↓                        END;


␈↓ ↓H␈↓The␈α∞reserved␈α
word␈α∞ANYTHING␈α
is␈α∞provided␈α
as␈α∞a␈α
wild␈α∞card␈α
to␈α∞avoid␈α
this␈α∞difficulty.␈α∞ Thus,␈α
we
␈↓ ↓H␈↓can write:

␈↓ ↓H␈↓        PLAN IF ¬ASSERTED(FORM(BLUE,HOLDS,ANYTHING)) THEN
␈↓ ↓H␈↓                BEGIN
␈↓ ↓H␈↓                {␈↓βwhatever␈↓}
␈↓ ↓H␈↓                END;

␈↓ ↓H␈↓One␈αrestriction␈αof␈αthe␈αcurrent␈α
implementation␈αis␈αthat␈αone␈αis␈α
not␈αallowed␈αto␈αassert␈αforms␈α
containing
␈↓ ↓H␈↓wild␈α
card␈α
elements␈α
like␈α
ANYTHING␈α
or␈α
the␈α
BIND␈α
construct␈α
discussed␈α
in␈α
the␈α
next␈α
section.␈α One
␈↓ ↓H␈↓can␈α∞only␈α∞use␈α∞them␈α∞in␈α∞constructs␈α∞like␈α∂ASSERTED,␈α∞which␈α∞don't␈α∞try␈α∞to␈α∞add␈α∞anything␈α∞to␈α∂the␈α∞data
␈↓ ↓H␈↓base.



␈↓ ↓H␈↓␈↓β3.5.4 BINDING BOOLEANS␈↓

␈↓ ↓H␈↓Frequently␈αa␈αsimple␈αwild␈αcard␈αelement␈αlike␈αANYTHING␈αdoes␈αnot␈αsuffice.␈α For␈αexample,␈αthe␈αuser
␈↓ ↓H␈↓may␈αwant␈αto␈αexecute␈αdifferent␈αcode,␈αdepending␈αon␈α
what␈αis␈αsupposed␈αto␈αbe␈αin␈αthe␈αblue␈αhand.␈α
 This
␈↓ ↓H␈↓situation is provided for by the use of

␈↓ ↓H␈↓        BIND(<ct variable>)

␈↓ ↓H␈↓as␈α∞one␈α
or␈α∞more␈α∞of␈α
the␈α∞elements␈α∞in␈α
a␈α∞FORM␈α
pattern␈α∞being␈α∞tested␈α
by␈α∞the␈α∞ASSERTED␈α
construct.
␈↓ ↓H␈↓Generally,␈αBIND(var)␈αacts␈αlike␈αa␈α"wild␈αcard"␈αthat␈αmatches␈αany␈αelement␈αin␈αthe␈αcorrect␈αposition␈αin␈αa
␈↓ ↓H␈↓form␈αthat␈αhas␈α
the␈αsame␈αtype␈αas␈α
var.␈α It␈αhas␈α
the␈αadditional␈αside␈αeffect␈α
of␈αsetting␈αthe␈αplanning␈α
value
␈↓ ↓H␈↓of var to be the value of the element it matched.  For example,
␈↓ ↓H␈↓3.5.4␈α?␈α?␈α?␈α?␈α?␈α?␈αεCONDITIONAL EXPANSION␈↓ 
aPage 65



␈↓ ↓H␈↓        ATOM thing;
␈↓ ↓H␈↓        PLANNING FRAME where;
␈↓ ↓H␈↓        :
␈↓ ↓H␈↓        ASSERT FORM(blue,HOLDS,frob);
␈↓ ↓H␈↓        ASSERT FORM(CORRECT_SPOT_FOR,frob,FRAME(ROT(Y,180),VECTOR(1,2,3)) );
␈↓ ↓H␈↓        ASSERT FORM(CORRECT_SPOT_FOR,widget,
␈↓ ↓H␈↓                                        FRAME(ROT(Y,180),VECTOR(4,5,6)) );
␈↓ ↓H␈↓        :
␈↓ ↓H␈↓        PLAN IF ASSERTED(FORM(blue,HOLDS,BIND(thing)) ) THEN
␈↓ ↓H␈↓                BEGIN
␈↓ ↓H␈↓                {␈↓βHere, #(thing) will get "FROB"␈↓}
␈↓ ↓H␈↓                IF ASSERTED(FORM(CORRECT_SPOT_FOR,#(thing),BIND(where))) THEN
␈↓ ↓H␈↓                        BEGIN
␈↓ ↓H␈↓                        MOVE blue TO #(where);
␈↓ ↓H␈↓                        {␈↓βsome more code␈↓}
␈↓ ↓H␈↓                        END
␈↓ ↓H␈↓                ELSE
␈↓ ↓H␈↓                        BEGIN
␈↓ ↓H␈↓                        {␈↓βsome sort of error message, perhaps␈↓}
␈↓ ↓H␈↓                        END;
␈↓ ↓H␈↓                END;

␈↓ ↓H␈↓Would expand into

␈↓ ↓H␈↓        MOVE blue TO FRAME(ROT(Y,π*RAD),VECTOR(1,2,3));
␈↓ ↓H␈↓        {␈↓βsome more code␈↓}

␈↓ ↓H␈↓This␈α
construct␈α
is␈α
especially␈α
useful␈α
for␈α
library␈α∞routines,␈α
which␈α
can␈α
use␈α
it␈α
to␈α
retrieve␈α∞properties␈α
of
␈↓ ↓H␈↓objects and then take appropriate action.



␈↓ ↓H␈↓␈↓β3.5.5 PICK␈↓

␈↓ ↓H␈↓One␈α
frequent␈α∞use␈α
of␈α
assertions␈α∞in␈α
to␈α∞specify␈α
a␈α
number␈α∞of␈α
properties␈α
of␈α∞some␈α
object␈α∞or␈α
variable.
␈↓ ↓H␈↓For instance,

␈↓ ↓H␈↓        ASSERT FORM(HEIGHT,widget,100*CM);
␈↓ ↓H␈↓        ASSERT FORM(WEIGHT,widget,200*GM);
␈↓ ↓H␈↓        ASSERT FORM(DEPROACH,widget,FRAME(ROT(Y,π*RAD),X));

␈↓ ↓H␈↓These properties can, of course, be retrieved by means of the ASSERTED construct, as in
␈↓ ↓H␈↓Page 66␈α?␈α?␈α?␈α?␈α?␈α-CONDITIONAL EXPANSION␈↓ ∂3.5.5



␈↓ ↓H␈↓        PLAN IF ASSERTED(FORM(HEIGHT,widget,BIND(h)) )  THEN
␈↓ ↓H␈↓                BEGIN
␈↓ ↓H␈↓                MOVE YELLOW TO widget + #(h);
␈↓ ↓H␈↓                :
␈↓ ↓H␈↓                END
␈↓ ↓H␈↓        ELSE
␈↓ ↓H␈↓                BEGIN
␈↓ ↓H␈↓                {␈↓βperhaps some sort of error message␈↓}
␈↓ ↓H␈↓                END

␈↓ ↓H␈↓Unfortunately,␈αthis␈α
sort␈αof␈α
thing␈αcan␈α
be␈αrather␈αinconvenient␈α
for␈αfetching␈α
values,␈αsince␈α
it␈αrequires
␈↓ ↓H␈↓explicit␈α
use␈α
of␈α
an␈α
auxiliary␈α
variable␈α
and␈α
a␈α
fairly␈α
long␈α
statement.␈α
 In␈α
such␈α
cases␈α
the␈αPICK␈α
construct
␈↓ ↓H␈↓can be used instead, as in

␈↓ ↓H␈↓        MOVE yellow TO widget + PICK(FORM(HEIGHT,widget,BIND(*)) )

␈↓ ↓H␈↓In general, PICK has the form

␈↓ ↓H␈↓        PICK(<form pattern>)

␈↓ ↓H␈↓where␈α
the␈α∞<form␈α
pattern>␈α∞contains␈α
"BIND(*)"␈α∞as␈α
␈↓βone␈↓␈α∞of␈α
its␈α∞terms.␈α
 PICK␈α∞causes␈α
the␈α∞compiler␈α
to
␈↓ ↓H␈↓retrieve␈α
a␈α
form␈α
that␈α
is␈α∞in␈α
the␈α
planning␈α
model␈α
and␈α∞which␈α
matches␈α
the␈α
template␈α
provided␈α∞by␈α
the
␈↓ ↓H␈↓<form pattern>.␈α The␈αvalue␈αin␈αthe␈αform␈αfrom␈αthe␈αdata␈αbase␈αcorresponding␈αto␈αthe␈α"BIND(*)"␈αterm
␈↓ ↓H␈↓in␈αthe␈αtemplate␈αpattern␈αis␈αthen␈αreturned␈αas␈αthe␈αvalue␈αfor␈αPICK.␈α Note␈αthat␈αthe␈αargument␈αtemplate
␈↓ ↓H␈↓can␈α
also␈α
contain␈α
additional␈α
instances␈α∞of␈α
ANYTHING␈α
and␈α
BIND(<variable>).␈α
 These␈α∞are␈α
bound
␈↓ ↓H␈↓in the usual way.  For instance,

␈↓ ↓H␈↓        ASSERT FORM(gadget,fits,onto,widget,at,FRAME(NILROT,X) );
␈↓ ↓H␈↓        :
␈↓ ↓H␈↓        obj ←← PICK(FORM(gadget,fits,onto,BIND(*),ANYTHING,BIND(locn)) );

␈↓ ↓H␈↓would set the planning value of obj to "widget" and that of locn to FRAME(NILROT,X).



␈↓ ↓H␈↓␈↓β3.5.6 PLAN FOREACH␈↓

␈↓ ↓H␈↓Sometimes,␈α∂there␈α∂may␈α∞be␈α∂several␈α∂assertions␈α∞in␈α∂the␈α∂data␈α∞base␈α∂that␈α∂could␈α∞satisfy␈α∂a␈α∂given␈α∞FORM
␈↓ ↓H␈↓retrieval pattern.  For instance,

␈↓ ↓H␈↓        ASSERT FORM(s1,SCREWS,INTO,h1);
␈↓ ↓H␈↓        ASSERT FORM(s2,SCREWS,INTO,h2);
␈↓ ↓H␈↓        ASSERT FORM(s3,SCREWS,INTO,h3);
␈↓ ↓H␈↓        :
␈↓ ↓H␈↓        PLAN IF ASSERTED(FORM(BIND(s),SCREWS,INTO,BIND(h))) THEN
␈↓ ↓H␈↓                BEGIN
␈↓ ↓H␈↓                :
␈↓ ↓H␈↓                END
␈↓ ↓H␈↓3.5.6␈α?␈α?␈α?␈α?␈α?␈α?␈αεCONDITIONAL EXPANSION␈↓ 
aPage 67



␈↓ ↓H␈↓In␈α
such␈αcases,␈α
the␈αcompiler␈α
would␈αarbitrarily␈α
pick␈αone␈α
of␈αthe␈α
eligible␈αpatterns␈α
to␈αuse␈α
as␈αits␈α
template
␈↓ ↓H␈↓for␈α
performing␈α
any␈αrequested␈α
bindings.␈α
 Suppose,␈αhowever,␈α
that␈α
the␈αuser␈α
wants␈α
to␈α
perform␈αsome
␈↓ ↓H␈↓action␈α
for␈α
␈↓βeach␈↓␈αpattern␈α
that␈α
matches,␈αrather␈α
than␈α
for␈α
only␈αone.␈α
 For␈α
instance,␈αhe␈α
may␈α
want␈αto␈α
insert
␈↓ ↓H␈↓all␈α∂the␈α∞screws␈α∂into␈α∂their␈α∞corresponding␈α∂holes.␈α∞ The␈α∂PLAN␈α∂FOREACH␈α∞construct␈α∂is␈α∂intended␈α∞to
␈↓ ↓H␈↓allow this sort of thing.

␈↓ ↓H␈↓        PLAN FOREACH <form> DO
␈↓ ↓H␈↓                 <statement>

␈↓ ↓H␈↓This␈α∂construct␈α∂will␈α∂cause␈α⊂<statement>␈α∂to␈α∂be␈α∂compiled␈α∂once␈α⊂for␈α∂each␈α∂instance␈α∂of␈α⊂<pattern>␈α∂that
␈↓ ↓H␈↓finds a match in the data base.

␈↓ ↓H␈↓For␈α∞instance,␈α∞a␈α∞library␈α∞routine␈α∂that␈α∞fastens␈α∞down␈α∞a␈α∞head␈α∞to␈α∂an␈α∞engine␈α∞block␈α∞by␈α∞means␈α∂of␈α∞bolts
␈↓ ↓H␈↓which can be inserted in any order might include a sequence like:

␈↓ ↓H␈↓        ATOM bolt, hole_id, head_id;
␈↓ ↓H␈↓        :
␈↓ ↓H␈↓        PLAN FOREACH FORM( BIND(bolt),FASTENS,#(head_id)) DO
␈↓ ↓H␈↓                BEGIN
␈↓ ↓H␈↓                PLAN IF ASSERTED(FORM(#(bolt),FITS,INTO,BIND(hole_id))) THEN
␈↓ ↓H␈↓                        INSERT #(bolt) INTO #(hole_id)
␈↓ ↓H␈↓                ELSE
␈↓ ↓H␈↓                        BEGIN
␈↓ ↓H␈↓                        PLAN ERROR(bolt,"doesn't fit into",hole_id);
␈↓ ↓H␈↓                        END;
␈↓ ↓H␈↓                END;

␈↓ ↓H␈↓If we then have assertions:

␈↓ ↓H␈↓        ASSERT FORM(b1,FASTENS,pumphead);
␈↓ ↓H␈↓        ASSERT FORM(b2,FASTENS,pumphead);
␈↓ ↓H␈↓        ASSERT FORM(b3,FASTENS,pumphead);
␈↓ ↓H␈↓        ASSERT FORM(b1,FRITS,INTO,h1);
␈↓ ↓H␈↓        ASSERT FORM(b2,FITS,INTO,h2);
␈↓ ↓H␈↓        ASSERT FORM(b3,FITS,INTO,h3);

␈↓ ↓H␈↓and call our library routine to put on pumphead, the above fragment would expand into

␈↓ ↓H␈↓        INSERT b1 INTO h1;
␈↓ ↓H␈↓        INSERT b2 INTO h2;
␈↓ ↓H␈↓        INSERT b3 INTO h3;
␈↓ ↓H␈↓Page 68␈α?␈α?␈α?␈α:THE COMPILE-TIME CHECK STATEMENT␈↓ $3.6



␈↓ ↓H␈↓␈↓∧3.6 THE COMPILE-TIME CHECK STATEMENT␈↓

␈↓ ↓H␈↓Since␈α
library␈α
routines␈α
will␈α
be␈α
commonly␈α
used,␈α
it␈α
is␈α
necessary␈α
to␈α
have␈α
some␈α
way␈α
of␈α
checking␈α
that
␈↓ ↓H␈↓necessary␈αpreconditions␈α
are␈αmet␈αas␈α
the␈αfirst␈αsteps␈α
of␈αthe␈αlibrary␈α
routine.␈α The␈αway␈α
this␈αis␈α
done␈αis
␈↓ ↓H␈↓with the ␈↓βcheck␈↓ statement.  A simple example:

␈↓ ↓H␈↓        CHECK  #(s1)=3 ∧ #(s2)>5

␈↓ ↓H␈↓The␈αcontents␈αof␈αthe␈αcheck␈αmay␈αbe␈αany␈αboolean␈αexpression,␈αincluding␈αchecks␈αon␈αthe␈αcurrent␈αworld
␈↓ ↓H␈↓model.␈α∂The␈α∞check␈α∂is␈α∞only␈α∂made␈α∞at␈α∂compile-time;␈α∂if␈α∞the␈α∂check␈α∞is␈α∂not␈α∞satisfied,␈α∂the␈α∂compiler␈α∞will
␈↓ ↓H␈↓generate an error message.  The effect of this statement is exactly like that of

␈↓ ↓H␈↓        PLAN IF ¬(#(s1)=3 ∧ #(s2)>5 THEN
␈↓ ↓H␈↓                PLAN ERROR("Check statement failed")   .






␈↓ ↓H␈↓␈↓∧3.7 LIBRARY ROUTINES␈↓

␈↓ ↓H␈↓Many␈α
of␈α
the␈α
applications␈α
for␈α
which␈α'AL␈α
is␈α
intended␈α
characteristicly␈α
involve␈α
repeating␈α
a␈αnumber␈α
of
␈↓ ↓H␈↓very␈α∞similar␈α∂subtasks.␈α∞ For␈α∞instance,␈α∂an␈α∞assembly␈α∞program␈α∂might␈α∞have␈α∞to␈α∂change␈α∞sockets␈α∂on␈α∞an
␈↓ ↓H␈↓electric␈α⊂driver␈α⊂many␈α⊂times␈α∂in␈α⊂order␈α⊂to␈α⊂drive␈α∂down␈α⊂a␈α⊂number␈α⊂of␈α∂different␈α⊂bolts.␈α⊂ If␈α⊂written␈α∂in
␈↓ ↓H␈↓"simple"␈α⊗'AL,␈α↔with␈α⊗each␈α↔such␈α⊗subtask␈α↔coded␈α⊗out␈α↔in␈α⊗explicit␈α↔statements␈α⊗like␈α↔MOVE␈α⊗and
␈↓ ↓H␈↓OPERATE,␈α
such␈α
programs␈α
would␈α
be␈αvery␈α
tedious␈α
to␈α
write␈α
and␈αdebug.␈α
 On␈α
the␈α
other␈α
hand,␈αthe
␈↓ ↓H␈↓necessity␈α
of␈α
planning␈α
motions␈α
frequently␈α
makes␈α
procedures␈α
(in␈α
the␈α
traditional␈α
sense)␈α
infeasible.␈α
 To
␈↓ ↓H␈↓overcome␈αthis␈α
difficulty,␈α'AL␈α
provides␈αa␈αfacility␈α
for␈α"routines",␈α
which␈αexternally␈α
resemble␈αmacros,
␈↓ ↓H␈↓in␈α∩that␈α∩they␈α∩are␈α∩"expanded"␈α∩each␈α∩time␈α∩they␈α∩are␈α∩invoked,␈α∩although␈α∩they␈α∩are␈α∩are␈α∩stored␈α⊃and
␈↓ ↓H␈↓manipulated␈α
by␈α
the␈α
compiler␈α
in␈α
a␈α
somewhat␈α
more␈α
efficient␈α
manner.␈α
 The␈α
'AL␈α
system␈α
will␈αinclude␈α
a
␈↓ ↓H␈↓predefined␈αlibrary␈αof␈αroutines␈αfor␈αperforming␈α
a␈αnumber␈αof␈αcommonly␈αuseful␈αfunctions,␈αalthough␈α
a
␈↓ ↓H␈↓user can, of course, "roll his own" by using the ROUTINE construct, which has the form

␈↓ ↓H␈↓        ROUTINE <id> (<parameter list>);
␈↓ ↓H␈↓                <body>

␈↓ ↓H␈↓where␈αthe␈α
<parameter␈αlist>␈α
syntax␈αis␈αthe␈α
same␈αas␈α
for␈αprocedure␈αdefinitions,␈α
and␈αthe␈α
<body>␈αmay
␈↓ ↓H␈↓be␈αeither␈αan␈αexpression␈αor␈αa␈αstatement.␈αWhen␈αthe␈αlibrary␈αroutine␈αis␈αexpanded,␈αall␈αinstances␈αof␈αthe
␈↓ ↓H␈↓parameter␈αnames␈αare␈αsubstituted␈αwith␈αthe␈αactual␈αparameters␈αsupplied␈αin␈αthe␈αcall.␈α Thus,␈α
a␈αtypical
␈↓ ↓H␈↓library routine declaration might look like:
␈↓ ↓H␈↓3.7␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α⊂LIBRARY ROUTINES␈↓ 
aPage 69



␈↓ ↓H␈↓        ROUTINE reach(SCALAR thickness;FRAME place);
␈↓ ↓H␈↓                BEGIN
␈↓ ↓H␈↓␈↓ βH␈↓β{causes␈α_the␈α_hand␈α_to␈α_move␈α_to␈α↔the␈α_indicated␈α_spot,␈α_and␈α_keep␈α_opening␈α↔&
␈↓ ↓H␈↓β␈↓ βHclosing its fingers until something is put in them}
␈↓ ↓H␈↓                SCALAR flag;
␈↓ ↓H␈↓                MOVE YELLOW TO place;
␈↓ ↓H␈↓                flag←1;
␈↓ ↓H␈↓                WHILE flag ≠ 0 DO
␈↓ ↓H␈↓                        BEGIN
␈↓ ↓H␈↓                        OPERATE YFINGERS WITH OPENING = 5;
␈↓ ↓H␈↓                        OPERATE YFINGERS WITH OPENING = thickness-.1
␈↓ ↓H␈↓                                ON YTOUCH DO
␈↓ ↓H␈↓                                        BEGIN
␈↓ ↓H␈↓                                        flag←0;
␈↓ ↓H␈↓                                        STOP;
␈↓ ↓H␈↓                                        END;
␈↓ ↓H␈↓                        END;
␈↓ ↓H␈↓                END


␈↓ ↓H␈↓Library␈α∞routines␈α∞without␈α∞parameters␈α∞are␈α∞invoked␈α∂simply␈α∞by␈α∞including␈α∞their␈α∞name␈α∞in␈α∂the␈α∞source
␈↓ ↓H␈↓program.␈α∂ For␈α∂instance,␈α∂suppose␈α∞we␈α∂have␈α∂a␈α∂library␈α∞routine␈α∂PARK_YELLOW␈α∂which␈α∂parks␈α∞the
␈↓ ↓H␈↓yellow arm.  Then

␈↓ ↓H␈↓        IF h>3 THEN
␈↓ ↓H␈↓                PARK_YELLOW

␈↓ ↓H␈↓might expand into something like

␈↓ ↓H␈↓        IF h>3 THEN
␈↓ ↓H␈↓                MOVE YELLOW TO YPARK

␈↓ ↓H␈↓There␈α∞are␈α∞several␈α∞ways␈α∞to␈α∞specify␈α∞parameters.␈α∂ Perhaps␈α∞the␈α∞simplest␈α∞is␈α∞to␈α∞follow␈α∞the␈α∂syntax␈α∞for
␈↓ ↓H␈↓procedure␈αcalls,␈αin␈αwhich␈αcase␈αthe␈αarguments␈αmust␈αcorrespond␈αin␈αorder␈αand␈αtype␈αwith␈αthose␈αin␈αthe
␈↓ ↓H␈↓statement which defined the routine.  For example,

␈↓ ↓H␈↓        reach(0.5, FRAME(ROT(Z,90*DEG),VECTOR(1,2,3)))

␈↓ ↓H␈↓This␈αcan␈αbecome␈αvery␈αinconvenient␈αfor␈αroutines␈αwhich␈αhave␈αa␈αlarge␈αnumber␈αof␈αparameters,␈αsince
␈↓ ↓H␈↓the␈αuser␈αmay␈αhave␈αtrouble␈αremembering␈αthe␈αcorrect␈αorder,␈αor␈αmay␈αwant␈αto␈αleave␈αsome␈α
unspecified.
␈↓ ↓H␈↓These difficulties are avoided by using the form

␈↓ ↓H␈↓        reach(thickness = 0.5,  place = FRAME(ROT(Z,90*DEG),VECTOR(1,2,3)) )

␈↓ ↓H␈↓It is possible to specify default values for parameters to library routines by including the construct

␈↓ ↓H␈↓        (DEFAULT <value>)

␈↓ ↓H␈↓after the parameter name in the formal parameter list for the routine.  For example,
␈↓ ↓H␈↓Page 70␈α?␈α?␈α?␈α?␈α?␈α?␈α'LIBRARY ROUTINES␈↓ $3.7



␈↓ ↓H␈↓        ROUTINE reach(FRAME arm(DEFAULT YELLOW),place;
␈↓ ↓H␈↓                                    SCALAR thickness(DEFAULT 0));
␈↓ ↓H␈↓                BEGIN
␈↓ ↓H␈↓                :
␈↓ ↓H␈↓                END

␈↓ ↓H␈↓        :
␈↓ ↓H␈↓        reach(BLUE,f1);  {␈↓βA thickness of 0 is assumed.␈↓}
␈↓ ↓H␈↓        reach(place=f2,thickness=10); {␈↓βYELLOW arm assumed.␈↓}


␈↓ ↓H␈↓The construct

␈↓ ↓H␈↓        SPECIFIED(<parameter id>)

␈↓ ↓H␈↓may␈α
be␈α
used␈α
in␈α
a␈α
compile-time␈α
conditional␈α
to␈α
test␈α
whether␈α
the␈α
named␈α
parameter␈α
has␈α
been␈α
assigned
␈↓ ↓H␈↓a value.  For example,

␈↓ ↓H␈↓        ROUTINE transmogrify(ATOM errdev;...);
␈↓ ↓H␈↓                BEGIN
␈↓ ↓H␈↓␈↓ βH␈↓β{Note␈α∪here␈α∪that␈α∪the␈α∪atom␈α∪errdev␈α∪is␈α∪merely␈α∪being␈α∪used␈α∪as␈α∪a␈α∪name␈α∪passing
␈↓ ↓H␈↓β␈↓ βHmechanism.}
␈↓ ↓H␈↓                :
␈↓ ↓H␈↓                IF errcond THEN
␈↓ ↓H␈↓                        BEGIN
␈↓ ↓H␈↓                        PLAN IF SPECIFIED(errdev)
␈↓ ↓H␈↓                                THEN OPERATE  (errdev)
␈↓ ↓H␈↓                                ELSE ABORT
␈↓ ↓H␈↓                        END;
␈↓ ↓H␈↓                :
␈↓ ↓H␈↓                END;

␈↓ ↓H␈↓If␈αa␈αparameter␈α
has␈αno␈αdefault␈α
value␈αspecified␈αand␈α
is␈αnot␈αbound␈α
by␈αthe␈αcall,␈α
then␈αany␈αexpansion␈α
of
␈↓ ↓H␈↓the␈αroutine␈αthat␈αuses␈αthe␈αparameter␈αwill␈αresult␈αin␈αan␈αerror;␈αoccurrences␈αof␈αan␈αunbound␈αparameter
␈↓ ↓H␈↓in the unexpanded part of a planning conditional are legal.

␈↓ ↓H␈↓Yet␈αanother␈αsyntax␈αis␈αacceptable␈αfor␈αinvocation␈αof␈αlibrary␈αroutines;␈αit␈αis␈αincluded␈αfor␈αcompatibility
␈↓ ↓H␈↓with␈αhigh␈αlevel␈αprimitives␈α(see␈αChapter␈α4).␈α In␈αthis␈αform,␈αthe␈αparameter␈αnames␈αact␈αlike␈αkey␈αwords
␈↓ ↓H␈↓identifying various clauses in a "pseudo-english" statement, as in

␈↓ ↓H␈↓        REACH thickness 0.5 place FRAME(ROT(Z,90*DEG),VECTOR(1,2,3))

␈↓ ↓H␈↓If␈αa␈αparameter␈αto␈αa␈αroutine␈αoccurs␈αin␈αthe␈αbody␈αin␈αsome␈αconstruct␈αwhere␈αa␈αvariable␈αmust␈αoccur␈α(eg.
␈↓ ↓H␈↓the␈α∞left␈α
hand␈α∞side␈α∞of␈α
an␈α∞assignment␈α∞statement),␈α
the␈α∞compiler␈α
will␈α∞do␈α∞the␈α
"right"␈α∞thing␈α∞when␈α
the
␈↓ ↓H␈↓corresponding␈α∞actual␈α∞parameter␈α∞is␈α∞a␈α∞constant␈α∂or␈α∞expression:␈α∞a␈α∞warning␈α∞will␈α∞be␈α∞printed,␈α∂and␈α∞the
␈↓ ↓H␈↓compiler will invent a temporary variable to hold the value.
␈↓ ↓H␈↓3.7.1␈α?␈α?␈α?␈α?␈α?␈α?␈α?LIBRARY ROUTINES␈↓ 
aPage 71



␈↓ ↓H␈↓␈↓β3.7.1 SAVING LIBRARY ROUTINES␈↓

␈↓ ↓H␈↓Library routines may be saved on a file by use of the statement (and supervisor command)

␈↓ ↓H␈↓        SAVE <flag> <routine name list> ON <file specifier>

␈↓ ↓H␈↓where <flag> may be either NEW, OLD, or <empty>. For instance,

␈↓ ↓H␈↓        SAVE reach, transmogrify ON "FEE.FIE[FO,FUM]";
␈↓ ↓H␈↓        SAVE OLD foobaz ON "DEFS.1[II,HE]";
␈↓ ↓H␈↓        SAVE NEW grab1, grab2, grab3 ON "GRABS";

␈↓ ↓H␈↓IF␈α
<flag>␈α
is␈α
<empty>␈αand␈α
one␈α
of␈α
the␈αnamed␈α
routines␈α
already␈α
exists␈αon␈α
the␈α
specified␈α
file,␈α
the␈αold
␈↓ ↓H␈↓definition␈αis␈αoverwritten.␈αIF␈α<flag>␈αis␈αNEW,␈αthen␈αonly␈αroutines␈αwhich␈αdo␈αnot␈αalready␈αexist␈αon␈αthe
␈↓ ↓H␈↓specified␈αfile␈αwill␈αbe␈αadded.␈α Similarly,␈αif␈α<flag>␈αis␈αOLD␈αthen␈αonly␈αroutines␈αwhich␈αare␈αalready␈αon
␈↓ ↓H␈↓the␈α
file␈α
will␈α
be␈α
saved.␈α
 If␈α
the␈α
<routine␈α
name␈α
list>␈α
is␈α
omitted,␈α
then␈α
all␈α
existing␈α
routines␈α
will␈α
be␈α
saved
␈↓ ↓H␈↓on the specified file.  E.g.

␈↓ ↓H␈↓        SAVE ON "DEFS.ALL";
␈↓ ↓H␈↓        SAVE NEW ON "DEFS.2";

␈↓ ↓H␈↓Library routines may be retrieved from a file by the command

␈↓ ↓H␈↓        RETRIEVE <flag> <routine name list> FROM <file specifier>

␈↓ ↓H␈↓If␈α∩<flag>␈α∩is␈α∩empty,␈α∩then␈α∩the␈α∩specified␈α∪routines␈α∩will␈α∩be␈α∩retrieved␈α∩from␈α∩the␈α∩specified␈α∪file.␈α∩ If,
␈↓ ↓H␈↓however,␈α∂<flag>␈α∞is␈α∂NEW,␈α∂then␈α∞only␈α∂routines␈α∂which␈α∞are␈α∂not␈α∞already␈α∂defined␈α∂will␈α∞be␈α∂read␈α∂in;␈α∞if
␈↓ ↓H␈↓<flag>␈α⊃is␈α⊃OLD,␈α⊂then␈α⊃only␈α⊃routines␈α⊃which␈α⊂are␈α⊃already␈α⊃defined␈α⊃will␈α⊂be␈α⊃retrieved␈α⊃(they␈α⊃will␈α⊂be
␈↓ ↓H␈↓redefined).␈α
 If␈α
the␈α
<routine␈α
name␈α
list>␈α
is␈α
<empty>,␈α
then␈α
all␈α
routines␈α
on␈α
the␈α
file␈α
will␈α
be␈α
read␈α
(subject
␈↓ ↓H␈↓to any restrictions imposed by <flag>).  Examples:

␈↓ ↓H␈↓        RETRIEVE FROM "DEFS.RCB";
␈↓ ↓H␈↓        RETRIEVE Aeneas, Dido FROM "CAVE";
␈↓ ↓H␈↓        RETRIEVE NEW FROM "AL.LIB[AL,HE]";




␈↓ ↓H␈↓␈↓β3.7.2 SAVING AND RESTORING PLANNING VALUES␈↓

␈↓ ↓H␈↓The␈α
statement␈αSAVE␈α
WORLD␈αON␈α
W1␈αwill␈α
cause␈αthe␈α
"world"␈αat␈α
that␈αpoint␈α
in␈αthe␈α
planning␈αto␈α
be
␈↓ ↓H␈↓written␈α∞out␈α∞into␈α∞a␈α∞file␈α∞called␈α∞W1.WLD.␈α∞ The␈α∞statement␈α∞RETRIEVE␈α∞WORLD␈α∞FROM␈α∞W1␈α∞will
␈↓ ↓H␈↓read␈α∞in␈α∞this␈α∞file␈α∞and␈α∞set␈α∞up␈α∞the␈α∂world␈α∞as␈α∞it␈α∞was␈α∞when␈α∞saved.␈α∞ The␈α∞world␈α∞includes␈α∂all␈α∞planning
␈↓ ↓H␈↓values␈α⊃and␈α∩all␈α⊃assertions.␈α∩ It␈α⊃does␈α∩not␈α⊃include␈α⊃defined␈α∩library␈α⊃routines.␈α∩ Saving␈α⊃the␈α∩world␈α⊃is
␈↓ ↓H␈↓particularly␈α
useful␈αfor␈α
recovering␈αwhen␈α
the␈α
arm␈αruns␈α
into␈αtrouble;␈α
it␈α
makes␈αit␈α
unnecessary␈αto␈α
begin
␈↓ ↓H␈↓the planning from scratch.

␈↓ ↓H␈↓It␈α∞is␈α
also␈α∞possible␈α∞to␈α
improve␈α∞the␈α∞planning␈α
values␈α∞of␈α∞frames␈α
after␈α∞a␈α∞period␈α
of␈α∞execution;␈α∞this␈α
is
␈↓ ↓H␈↓Page 72␈α?␈α?␈α?␈α?␈α?␈α?␈α'LIBRARY ROUTINES␈↓ ∂3.7.2



␈↓ ↓H␈↓done␈α
by␈α
the␈α
statement␈αRESTORE␈α
WORLD␈α
FROM␈α
RUNTIME.␈α
 The␈αeffect␈α
of␈α
this␈α
is␈α
that␈αall␈α
the
␈↓ ↓H␈↓variables␈α∞which␈α∞the␈α∞runtime␈α∞knows␈α∞about␈α∞are␈α∞read,␈α∞and␈α∞their␈α∞values␈α∞become␈α∞the␈α∂new␈α∞planning
␈↓ ↓H␈↓values for those variables.
␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α
␈↓ 
aPage 73



␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α/␈↓∧CHAPTER 4␈↓
␈↓ ↓H␈↓␈α?␈α?␈α:␈↓¬VERY HIGH LEVEL LANGUAGE CAPABILITIES␈↓





␈↓ ↓H␈↓␈↓∧4.1 INTRODUCTION ␈↓

␈↓ ↓H␈↓To␈α∂date,␈α∂manipulator␈α∂control␈α⊂languages␈α∂have␈α∂been␈α∂very␈α⊂explicit,␈α∂with␈α∂the␈α∂user␈α⊂giving␈α∂detailed
␈↓ ↓H␈↓specifications␈αof␈αwhat␈αmotions␈α
are␈αto␈αbe␈αmade,␈α
what␈αsensors␈αare␈αto␈α
be␈αtested,␈αetc.␈αTo␈α
some␈αextent
␈↓ ↓H␈↓this␈α∂is␈α∂also␈α∂true␈α∂of␈α∂'AL.␈α∂ One␈α∞can␈α∂conceive␈α∂of␈α∂programming␈α∂complicated␈α∂assemblies␈α∂using␈α∞only
␈↓ ↓H␈↓MOVE␈αand␈αOPERATE␈αstatements,␈αcondition␈α
monitors,␈αand␈αthe␈αlike.␈α In␈αpractice,␈α
however,␈αsuch
␈↓ ↓H␈↓an␈α∞approach␈α∞has␈α∞many␈α∞disadvantages␈α∞for␈α∞users,␈α∞who␈α∞frequently␈α∞don't␈α∞care␈α∞about␈α∞all␈α∂the␈α∞details
␈↓ ↓H␈↓needed␈α
to␈α
produce␈α
a␈αprogram␈α
at␈α
the␈α
manipulator␈α
level.␈α For␈α
instance,␈α
an␈α
assembly␈α
engineer␈αwho
␈↓ ↓H␈↓wants to put an engine together might typically want to write something like:

␈↓ ↓H␈↓        :
␈↓ ↓H␈↓        FIT enginehead ONTO engineblock
␈↓ ↓H␈↓                WITH ALIGNMENT stud_x IN headhole_x,
␈↓ ↓H␈↓                               stud_y IN headhole_y;
␈↓ ↓H␈↓        INSERT bolt1 IN headhole1
␈↓ ↓H␈↓                USING TOOL driver
␈↓ ↓H␈↓                WITH TORQUE 10;
␈↓ ↓H␈↓        INSERT bolt2 IN headhole2
␈↓ ↓H␈↓                USING TOOL driver
␈↓ ↓H␈↓                WITH TORQUE 10;
␈↓ ↓H␈↓        INSERT drainplug IN sidehole;
␈↓ ↓H␈↓        :


␈↓ ↓H␈↓and allow the system to fill in the details, rather than coding up all the motions herself.

␈↓ ↓H␈↓This␈α⊂chapter␈α⊂gives␈α⊂an␈α⊂overview␈α⊂of␈α⊂those␈α⊂parts␈α⊂of␈α⊂'AL␈α⊂that␈α⊂allow␈α⊂the␈α⊂user␈α⊂to␈α⊂specify␈α⊂tasks␈α∂at
␈↓ ↓H␈↓somewhat␈α∪more␈α∪convenient␈α∪levels␈α∪of␈α∩abstraction␈α∪than␈α∪provided␈α∪by␈α∪the␈α∪manipulation␈α∩control
␈↓ ↓H␈↓statements␈α
alone.␈α
 Here,␈αwe␈α
are␈α
concerned␈αwith␈α
a␈α
"semi-automatic"␈αprogramming␈α
system␈α
that␈αcan
␈↓ ↓H␈↓make␈α
a␈α
number␈α
of␈αthe␈α
specific␈α
decisions␈α
required␈αto␈α
turn␈α
an␈α
"high␈αlevel"␈α
task␈α
description␈α
into␈αa
␈↓ ↓H␈↓running␈α∩program␈α∩and␈α∪which␈α∩can␈α∩ask␈α∩for␈α∪(and␈α∩accept)␈α∩help␈α∩for␈α∪those␈α∩details␈α∩that␈α∪it␈α∩cannot
␈↓ ↓H␈↓determine for itself.

␈↓ ↓H␈↓The␈αrange␈αof␈αdecisions␈αthat␈αthe␈αsystem␈αmay␈αhave␈αto␈αmake␈αis␈αquite␈αbroad,␈αranging␈αfrom␈αvery␈αlocal
␈↓ ↓H␈↓matters,␈αsuch␈αas␈αthe␈αnumber␈αof␈αtrajectories␈αwhich␈αmust␈αbe␈αplanned␈αto␈αensure␈αcorrect␈αperformance
␈↓ ↓H␈↓of␈α
all␈α
cases␈α
of␈α
some␈α
motion␈α
request,␈α
to␈α
rather␈α
global␈α
decisions,␈α
such␈α
as␈α
how␈α
an␈α
object␈α
should␈α
be
␈↓ ↓H␈↓grasped,␈αhow␈α
an␈αobject␈αorientation␈α
is␈αto␈α
be␈αdetermined,␈αor␈α
what␈αshould␈αbe␈α
the␈αrelative␈α
order␈αfor
␈↓ ↓H␈↓executing several related subtasks.

␈↓ ↓H␈↓Some␈αof␈α
these␈αdecisions␈α
are␈αessentially␈αdomain-independent.␈α
 For␈αexample,␈α
the␈αsystem␈αdecides␈α
how
␈↓ ↓H␈↓many␈α
different␈α
arm␈α
trajectories␈αit␈α
must␈α
plan␈α
for␈α
a␈αgiven␈α
MOVE␈α
statement␈α
by␈α
examining␈αits␈α
model
␈↓ ↓H␈↓Page 74␈α?␈α?␈α?␈α?␈α?␈α?␈α?INTRODUCTION ␈↓ $4.1



␈↓ ↓H␈↓of␈α∞the␈α∂locus␈α∞of␈α∂the␈α∞destination␈α∂frame␈α∞(see␈α∂Section␈α∞4.6),␈α∂without␈α∞much␈α∂regard␈α∞for␈α∂the␈α∞"meaning"
␈↓ ↓H␈↓of␈αthe␈αframe␈αvariable.␈α Other␈αdecisions␈αmay␈αrequire␈αa␈αsignificant␈αdegree␈αof␈αspecialized␈αknowledge
␈↓ ↓H␈↓about␈αthe␈αtask␈αdomain.␈α For␈αinstance,␈αthe␈αINSERT␈αprimitive␈αin␈αour␈αexample␈αwould␈αneed␈αto␈αknow
␈↓ ↓H␈↓how␈α∞a␈α∞nutdriver␈α
is␈α∞used␈α∞to␈α
grasp␈α∞a␈α∞bolt,␈α∞what␈α
effects␈α∞(if␈α∞any)␈α
the␈α∞shape␈α∞of␈α
the␈α∞bolt␈α∞tip␈α∞or␈α
hole
␈↓ ↓H␈↓chamfer␈αhas␈αon␈αchoice␈αof␈αsearch␈αmethod,␈αwhat␈αconstraints␈αare␈αimposed␈αon␈αworkpiece␈αpositioning,
␈↓ ↓H␈↓and␈αmuch␈αmore.␈αOne␈αvery␈αimportant␈αconstraint␈αon␈αthe␈αoutput␈αprogram␈αis␈αthat␈αit␈αbe␈αconsistent,␈αin
␈↓ ↓H␈↓the␈α∂sense␈α∂that␈α∂code␈α∂generated␈α∂to␈α∂accomplish␈α∂one␈α∂subtask␈α∂should␈α∂not␈α∂be␈α∂inconsistent␈α∂with␈α∂(and,
␈↓ ↓H␈↓indeed,␈αshould␈αfacilitate)␈αthe␈α
accomplishment␈αof␈αother␈αsubtasks.␈α
 This␈αnecessity,␈αin␈αturn,␈α
frequently
␈↓ ↓H␈↓generates␈α∞further␈α∂requirements␈α∞for␈α∞specialized␈α∂knowledge␈α∞about␈α∞the␈α∂requirements␈α∞and␈α∂effects␈α∞of
␈↓ ↓H␈↓the primitives being provided.

␈↓ ↓H␈↓We␈α
have␈α
chosen␈αsmall␈α
scale␈α
industrial␈α
automation␈αas␈α
a␈α
good␈αdomain␈α
for␈α
investigating␈α
the␈αissues
␈↓ ↓H␈↓involved␈α∂in␈α∂incorporating␈α⊂such␈α∂specialized␈α∂knowledge␈α∂into␈α⊂'AL,␈α∂and␈α∂this␈α∂discussion␈α⊂is␈α∂oriented
␈↓ ↓H␈↓accordingly.␈α⊗ However,␈α∃many␈α⊗of␈α∃the␈α⊗mechanisms␈α∃underlying␈α⊗the␈α∃various␈α⊗language␈α∃features
␈↓ ↓H␈↓discussed␈αhere␈αare␈αfairly␈αgeneral;␈αan␈αexpert␈αsystem␈αfor␈αsome␈αother␈αmanipulatory␈αdomain␈αcould␈αbe
␈↓ ↓H␈↓organized␈αalong␈αthe␈αsame␈αlines␈αand,␈αindeed,␈α
could␈αuse␈αat␈αleast␈αsome␈αof␈αthe␈αsame␈α
primitives.␈α The
␈↓ ↓H␈↓ease␈α∂of␈α∂such␈α∂adaptation␈α∂would␈α∂depend,␈α∂of␈α∂course,␈α∞on␈α∂the␈α∂closeness␈α∂of␈α∂the␈α∂domains␈α∂and␈α∂on␈α∞the
␈↓ ↓H␈↓particular primitives involved.





␈↓ ↓H␈↓␈↓∧4.2 MACRO OPERATIONS AS A `HIGH LEVEL LANGUAGE'␈↓

␈↓ ↓H␈↓One␈α∪obvious␈α∪partial␈α∪solution␈α∪is␈α∪to␈α∪combine␈α∪commonly␈α∪occuring␈α∪code␈α∪sequences␈α∪into␈α∪"macro
␈↓ ↓H␈↓operations",␈α∞and␈α
then␈α∞allow␈α
the␈α∞user␈α
to␈α∞specify␈α
tasks␈α∞in␈α
terms␈α∞of␈α
those␈α∞operations.␈α∞ 'AL␈α
includes
␈↓ ↓H␈↓sophisticated␈αmacro,␈α
defined␈αroutine,␈α
and␈αconditional␈αcompilation␈α
facilities␈α(see␈α
Chapter␈α3)␈αfor␈α
this
␈↓ ↓H␈↓purpose.␈α Such␈αlibrary␈αroutines␈αhave␈αthe␈αadvantage␈αof␈αbeing␈αrelatively␈αeasy␈αfor␈αa␈αperson␈αfamiliar
␈↓ ↓H␈↓with␈α'AL␈αto␈αwrite,␈αand␈αare␈αgenerally␈αat␈αleast␈αpartially␈αself-documenting.␈α Typically,␈αa␈αuser␈αwishing
␈↓ ↓H␈↓to␈α∂know␈α∂what␈α∂a␈α∂given␈α∂library␈α∂routine␈α∂does␈α∂can␈α∂find␈α∂out␈α∂merely␈α∂by␈α∂looking␈α∂at␈α∂a␈α∂listing␈α⊂of␈α∂the
␈↓ ↓H␈↓routine,␈α∂which␈α∂will␈α∞(of␈α∂course)␈α∂be␈α∂written␈α∞in␈α∂a␈α∂clear,␈α∂well␈α∞structured␈α∂style␈α∂with␈α∂many␈α∞comments
␈↓ ↓H␈↓describing␈α∂the␈α∂more␈α∞obscure␈α∂passages.␈α∂ Generally,␈α∞such␈α∂libraries␈α∂are␈α∞most␈α∂useful␈α∂where␈α∂there␈α∞is
␈↓ ↓H␈↓essentially␈α∞only␈α∂one␈α∞way␈α∂to␈α∞do␈α∂a␈α∞given␈α∂subtask,␈α∞all␈α∂actions␈α∞required␈α∂to␈α∞do␈α∂each␈α∞subtask␈α∂can␈α∞be
␈↓ ↓H␈↓performed␈αat␈αone␈αplace␈αin␈αthe␈αoutput␈αprogram,␈αand␈αdifferent␈αsubtasks␈αare␈αessentially␈αindependent.
␈↓ ↓H␈↓When these conditions are not fully met, more powerful techniques are needed.





␈↓ ↓H␈↓␈↓∧4.3 MORE POWERFUL PRIMITIVES -- AN OVERVIEW␈↓

␈↓ ↓H␈↓Many␈α↔domains␈α↔are␈α↔sufficiently␈α↔complicated␈α_that␈α↔macro␈α↔expansion,␈α↔even␈α↔when␈α_used␈α↔with
␈↓ ↓H␈↓conditional␈αcompilation,␈αis␈α
too␈αlimited.␈α In␈αassembly,␈α
there␈αmay␈αbe␈αa␈α
number␈αof␈αdifferent␈α
ways␈αto
␈↓ ↓H␈↓do␈α
some␈α
particular␈α
task;␈α
which␈αway␈α
is␈α
"right"␈α
depends␈α
very␈αlargely␈α
on␈α
what␈α
other␈α
subtasks␈αmust␈α
be
␈↓ ↓H␈↓done.␈α∂Similarly,␈α∂it␈α∂is␈α∂frequently␈α∂possible␈α∂to␈α∂perform␈α∞part␈α∂of␈α∂one␈α∂subtask␈α∂(or,␈α∂at␈α∂least,␈α∂to␈α∞gather
␈↓ ↓H␈↓useful␈α
information)␈αin␈α
the␈αcourse␈α
of␈αdoing␈α
another␈αone.␈α
 Such␈αconsiderations␈α
are␈αin␈α
general␈αvery
␈↓ ↓H␈↓difficult to express within the paradigm of macro expansion.
␈↓ ↓H␈↓4.3␈α?␈α?␈α?␈α?␈α?␈α?␈α$HIGH-LEVEL PRIMITIVES␈↓ 
aPage 75



␈↓ ↓H␈↓In␈α
our␈α
introductory␈α
example,␈α
for␈α
instance,␈α
the␈α
system␈αmust␈α
decide␈α
how␈α
the␈α
engine␈α
block␈α
is␈α
to␈αbe
␈↓ ↓H␈↓oriented␈αto␈α
facilitate␈αputting␈αon␈α
the␈αhead.␈α
 Furthermore,␈αthe␈αblock␈α
alignment␈αmust␈α
be␈αsufficiently
␈↓ ↓H␈↓well␈α
determined␈αso␈α
that␈α
the␈αthe␈α
aligning␈αstuds␈α
can␈α
find␈αtheir␈α
way␈αinto␈α
the␈α
holes.␈αOne␈α
way␈α
to␈αdo
␈↓ ↓H␈↓this␈αmight␈αbe␈αto␈αpush␈α
the␈αengine␈αblock␈αup␈αagainst␈αa␈α
simple␈αaligning␈αjig␈αconsisting␈αof␈αa␈α
low␈αwall.
␈↓ ↓H␈↓Other␈αmethods␈αmight␈αinclude␈αvision␈αor␈αsimply␈α
grasping␈αkey␈αfeatures␈αof␈αthe␈αblock␈αand␈αreading␈α
the
␈↓ ↓H␈↓hand␈α∂coordinates.␈α∂ Once␈α∂the␈α∂head␈α∂is␈α∂on,␈α∞the␈α∂system␈α∂must␈α∂insert␈α∂the␈α∂bolts␈α∂and␈α∂drainplug.␈α∞ The
␈↓ ↓H␈↓system␈αwould␈αlike␈αto␈αavoid␈αmoving␈αthe␈αengine␈αblock␈αaround␈αmore␈αthan␈αit␈αhas␈αto,␈αsince␈αeach␈αmove
␈↓ ↓H␈↓requires␈αtime␈αand␈αmay␈αintroduce␈αuncertainties.␈α This␈αmeans␈αthat␈αit␈αshould␈αchoose␈αa␈αblock␈αposition
␈↓ ↓H␈↓that␈αallows␈αthe␈αarm␈αto␈αreach␈αthe␈αbolt␈αand␈αdrain␈αholes.␈α If␈αan␈αaligning␈αjig␈αis␈αin␈αuse,␈αcare␈αshould␈αbe
␈↓ ↓H␈↓taken␈α∞to␈α∞keep␈α∞the␈α∞side␈α∞hole␈α∞free␈α
if␈α∞possible,␈α∞and␈α∞so␈α∞forth.␈α∞Furthermore,␈α∞an␈α∞alignment␈α
technique
␈↓ ↓H␈↓that␈α
visually␈α
locates␈α
the␈α
engine␈α
block␈α
head␈α
holes␈α
is␈α
apt␈α
to␈α
yield␈α
more␈α
useful␈α
information␈α∞for␈α
the
␈↓ ↓H␈↓insertion␈αtasks␈α
than␈αwould␈α
some␈αcruder,␈α
but␈αless␈αexpensive,␈α
test␈αwhich␈α
may␈αwork␈α
just␈αas␈α
well␈αfor
␈↓ ↓H␈↓the purpose of mating the head.

␈↓ ↓H␈↓A␈α
full␈α
discussion␈α
of␈α
the␈α
mechanisms␈α
used␈α∞by␈α
the␈α
system␈α
to␈α
transform␈α
a␈α
high␈α
level␈α∞program␈α
into
␈↓ ↓H␈↓one␈α∞that␈α
can␈α∞actually␈α∞run␈α
is␈α∞beyond␈α∞the␈α
scope␈α∞of␈α
this␈α∞paper.␈α∞ Briefly,␈α
'AL␈α∞works␈α∞by␈α
progressive
␈↓ ↓H␈↓refinement␈αof␈αthe␈αuser's␈αprogram␈αspecifications,␈αand␈αuses␈αprocess␈αinstantiation␈αand␈αcommunication
␈↓ ↓H␈↓mechanisms␈α∞to␈α∞keep␈α
track␈α∞of␈α∞the␈α∞various␈α
subtasks␈α∞and␈α∞to␈α∞ensure␈α
that␈α∞all␈α∞decisions␈α∞are␈α
mutually
␈↓ ↓H␈↓compatible.␈α Knowledge␈αabout␈αassembly␈αprimitives␈αis␈αencoded␈αinto␈αa␈αnumber␈αof␈αprocedures␈αinside
␈↓ ↓H␈↓the␈α
expander.␈α
 With␈α
each␈αprogram␈α
statement,␈α
the␈α
system␈αassociates␈α
a␈α
process␈α
instantiation␈α
of␈αthe
␈↓ ↓H␈↓appropriate␈α⊂procedure␈α⊂(of␈α∂course,␈α⊂the␈α⊂processes␈α∂for␈α⊂low-level␈α⊂'AL␈α∂statements␈α⊂are␈α⊂fairly␈α∂trivial).
␈↓ ↓H␈↓These␈α∃processes␈α∀are␈α∃then␈α∀arranged␈α∃into␈α∀a␈α∃prerequisite␈α∀graph␈α∃based␈α∀initially␈α∃on␈α∃the␈α∀user's
␈↓ ↓H␈↓specification␈α∪of␈α∩what␈α∪must␈α∪be␈α∩done␈α∪before␈α∪what␈α∩(see␈α∪subsection␈α∪2.5.3).␈α∩ A␈α∪number␈α∪of␈α∩other
␈↓ ↓H␈↓"bureaucrat"␈α⊃processes␈α⊃are␈α⊃created␈α⊃to␈α∩work␈α⊃out␈α⊃compromises,␈α⊃invent␈α⊃new␈α⊃service␈α∩tasks,␈α⊃decide
␈↓ ↓H␈↓relative␈α⊂ordering,␈α⊂watch␈α⊂out␈α⊂for␈α⊂obvious␈α⊂inefficiencies␈α⊂(such␈α⊂as␈α⊂putting␈α⊂down␈α⊂a␈α⊂tool␈α⊂and␈α∂then
␈↓ ↓H␈↓picking␈αit␈αright␈αback␈αup␈αagain),␈αand␈αso␈α
on.␈α As␈αthe␈αplan␈αbecomes␈αmore␈αdetailed,␈αand␈α
as␈αdecisions
␈↓ ↓H␈↓are␈α
made␈α
about␈αthe␈α
order␈α
in␈αwhich␈α
subtasks␈α
are␈αto␈α
be␈α
performed,␈αsuccessive␈α
copies␈α
of␈αthe␈α
program
␈↓ ↓H␈↓graph␈αare␈αgenerated.␈α (Additional␈αinformation␈αis␈αstored␈αboth␈αin␈αthe␈αdata␈αbase␈αand␈αin␈αthe␈αinternal
␈↓ ↓H␈↓state␈α∂of␈α∂the␈α∞various␈α∂subtask␈α∂processes.)␈α∞The␈α∂final␈α∂phase␈α∞is␈α∂to␈α∂run␈α∞down␈α∂the␈α∂(linearized)␈α∞graph,
␈↓ ↓H␈↓asking each subtask process to generate the appropriate output code.





␈↓ ↓H␈↓␈↓∧4.4 CALLING HIGH LEVEL PRIMITIVES␈↓

␈↓ ↓H␈↓The␈α∂syntax␈α⊂for␈α∂high␈α∂level␈α⊂primitives␈α∂is␈α⊂keyword-oriented␈α∂and␈α∂resembles␈α⊂that␈α∂for␈α⊂MOVE␈α∂and
␈↓ ↓H␈↓OPERATE␈α∩statements␈α∩in␈α∩the␈α∩sense␈α∩that␈α∩there␈α∩is␈α∩a␈α∩main␈α∩clause␈α∩naming␈α∩the␈α∩operation,␈α⊃with
␈↓ ↓H␈↓possibly␈α
a␈α
number␈α∞of␈α
subordinate␈α
clauses␈α
giving␈α∞further␈α
specifications␈α
as␈α
to␈α∞what␈α
is␈α
to␈α∞be␈α
done.
␈↓ ↓H␈↓For example,

␈↓ ↓H␈↓        INSERT screw1 INTO hole1    {␈↓βmain clause␈↓}
␈↓ ↓H␈↓                USING TOOL nutdriver {␈↓βsubordinate clause␈↓}
␈↓ ↓H␈↓                WITH TORQUE = 10 {␈↓βsubordinate clause␈↓}


␈↓ ↓H␈↓For␈α∞convenience␈α∞and␈α∞readability,␈α∞a␈α∞number␈α
of␈α∞different␈α∞forms␈α∞are␈α∞acceptable.␈α∞ For␈α∞instance,␈α
the
␈↓ ↓H␈↓Page 76␈α?␈α?␈α?␈α?␈α0CALLING HIGH LEVEL PRIMITIVES␈↓ $4.4



␈↓ ↓H␈↓words␈α∪"WITH"␈α∩and␈α∪"USING"␈α∩are␈α∪interchangeable,␈α∩and␈α∪punctuation␈α∩(like␈α∪the␈α∩"=",␈α∪above)␈α∩is
␈↓ ↓H␈↓frequently␈αoptional.␈α Some␈αof␈αthe␈αsubordinate␈αclauses␈αmay␈αthemselves␈αcontain␈αseveral␈αelements,␈αas
␈↓ ↓H␈↓in

␈↓ ↓H␈↓        FIT carburetor ONTO engine_assembly_1
␈↓ ↓H␈↓                WITH ALIGNMENT
␈↓ ↓H␈↓                        carburetor_hole1 OVER stud1,
␈↓ ↓H␈↓                        carburetor_hole2 OVER stud2;

␈↓ ↓H␈↓In such cases, a comma is used to delimit successive elements.

␈↓ ↓H␈↓Initially,␈αonly␈αa␈αfairly␈αsmall␈αset␈αof␈αhigh␈αlevel␈αprimitives␈αis␈αbeing␈αimplemented,␈αalthough␈αsome␈α(like
␈↓ ↓H␈↓INSERT)␈α∞may␈α∞be␈α∞quite␈α∞flexible.␈α∞ Even␈α∞a␈α∞few␈α∞primitives,␈α∞however,␈α∞turn␈α∞out␈α∞to␈α∞be␈α∞sufficient␈α
for
␈↓ ↓H␈↓many␈α
interesting␈αtasks,␈α
and␈αprovide␈α
quite␈αa␈α
rich␈α
environment␈αfor␈α
investigation␈αof␈α
how␈αthe␈α
various
␈↓ ↓H␈↓parts of the system interact.

␈↓ ↓H␈↓Probably␈αthe␈αmost␈αelaborate␈αprimitive␈αis␈αINSERT,␈αwhich␈αis␈αgenerally␈αresponsible␈αfor␈αinsertion␈αof
␈↓ ↓H␈↓shafts and shaft-like objects (including screws) into holes.  The main clause is

␈↓ ↓H␈↓        INSERT <shaft-specification> INTO <hole-specification>

␈↓ ↓H␈↓where␈α
the␈α
<shaft-specification>␈α
should␈α
be␈α
either␈α
an␈α
object␈αof␈α
type␈α
shaft␈α
or␈α
one␈α
end␈α
of␈α
an␈αobject␈α
of
␈↓ ↓H␈↓type␈αshaft.␈α In␈αthe␈αformer␈αcase,␈αthe␈αsystem␈α
will␈αassume␈αthat␈αthe␈α"bottom␈αend"␈αof␈αthe␈αspecified␈α
shaft
␈↓ ↓H␈↓should␈α∩be␈α∩inserted␈α∩into␈α⊃the␈α∩named␈α∩hole.␈α∩(See␈α⊃Section␈α∩4.7)␈α∩Similarly,␈α∩the␈α∩<hole␈α⊃specification>
␈↓ ↓H␈↓may␈αbe␈αeither␈αthe␈α
name␈αof␈αa␈αhole␈α
or␈αof␈αa␈αbore,␈α
in␈αwhich␈αcase␈αthe␈α
top␈αend␈αwill␈αbe␈α
assumed.␈α 'AL
␈↓ ↓H␈↓can␈αlearn␈α
a␈αgood␈α
part␈αof␈α
exactly␈αwhat␈α
it␈αis␈αbeing␈α
asked␈αto␈α
do␈αby␈α
looking␈αat␈α
the␈αobject␈αmodels.␈α
 For
␈↓ ↓H␈↓instance,␈α
if␈α
the␈α
shaft␈α
and␈α
bore␈α
are␈α
both␈α
threaded␈α
and␈α
have␈α
the␈α
same␈α
diameter,␈α
then␈α
the␈α
system␈α
will
␈↓ ↓H␈↓attempt␈αto␈αscrew␈αin␈αthe␈αshaft␈αproperly.␈α Similarly,␈αby␈αlooking␈αat␈αthe␈αchamfer␈αof␈αthe␈αhole,␈αthe␈αtaper
␈↓ ↓H␈↓of␈α
the␈α
shaft,␈α
and␈α
the␈α
region␈α
around␈α∞the␈α
hole,␈α
the␈α
system␈α
can␈α
decide␈α
how␈α
much␈α∞determination␈α
is
␈↓ ↓H␈↓required,␈αwhat␈αsort␈αof␈αsearch␈αmight␈αbe␈αapplicable,␈αetc.␈α Further␈αspecifications␈αmay␈αbe␈αincluded␈αin
␈↓ ↓H␈↓subordinate␈αclauses,␈αsuch␈αas␈αthe␈αTOOL␈αand␈αTORQUE␈αclauses␈αin␈αour␈αfirst␈αexample,␈αor␈αas␈αin␈αthe
␈↓ ↓H␈↓TWIST clause of

␈↓ ↓H␈↓        INSERT aligning_pin INTO guide_hole
␈↓ ↓H␈↓                WITH TWIST = 3

␈↓ ↓H␈↓which␈αsays␈αthat␈αthe␈αpin␈αis␈αto␈αbe␈αgiven␈αthree␈αturns␈αcounter-clockwise␈αas␈αit␈αis␈αpushed␈αinto␈αthe␈α
guide
␈↓ ↓H␈↓hole.␈α⊂ Additional␈α∂"advice"␈α⊂may␈α⊂also␈α∂be␈α⊂provided␈α⊂in␈α∂the␈α⊂data␈α∂base.␈α⊂ For␈α⊂instance,␈α∂if␈α⊂there␈α⊂is␈α∂a
␈↓ ↓H␈↓special␈αroutine␈αfor␈αgrasping␈α"type␈α1"␈αscrews␈αwith␈αthe␈αnutdriver,␈αthere␈αmight␈αbe␈αan␈αassertion␈αof␈αthe
␈↓ ↓H␈↓form:

␈↓ ↓H␈↓        FORM(GRASPING_METHOD, screwtype1, nutdriver, routineid)

␈↓ ↓H␈↓(This␈α∞example␈α
rather␈α∞oversimplifies␈α∞the␈α
actual␈α∞mechanism␈α∞used␈α
to␈α∞describe␈α∞this␈α
sort␈α∞of␈α∞thing;␈α
a
␈↓ ↓H␈↓fuller description, however, is beyond the scope of this paper.)

␈↓ ↓H␈↓Another fairly elaborate primitive is
␈↓ ↓H␈↓        FIT <object1> ONTO <object2>
␈↓ ↓H␈↓4.4␈α?␈α?␈α?␈α?␈α?␈α→CALLING HIGH LEVEL PRIMITIVES␈↓ 
aPage 77



␈↓ ↓H␈↓where␈α⊂<object1>␈α⊂is␈α⊂usually␈α⊂a␈α⊂subpart␈α⊂of␈α⊂assembly␈α⊂<object2>.␈α⊂(See␈α⊂Section␈α⊂4.7␈α⊂for␈α⊂more␈α∂details
␈↓ ↓H␈↓about␈α
assemblies.)␈α
If␈α
this␈α
is␈α
not␈α
the␈α
case,␈α
then␈α
the␈α
attachment␈α
location␈α
must␈α
be␈α
specified␈α
by␈α
a␈α
clause
␈↓ ↓H␈↓of the form

␈↓ ↓H␈↓        AT <transform>

␈↓ ↓H␈↓The most common modifying clause for this primitive is an alignment specification, such as

␈↓ ↓H␈↓        WITH ALIGNMENT
␈↓ ↓H␈↓                <hole> OVER <shaft>,
␈↓ ↓H␈↓                <obj 1 feature> MEETS <obj 2 feature>,
␈↓ ↓H␈↓                <shaft> INTO <hole>

␈↓ ↓H␈↓Other primitives include:

␈↓ ↓H␈↓        SLIP <collar> OVER <shaft>  {includes nut over threaded shaft}

␈↓ ↓H␈↓        PLACE <object> ON <surface>
␈↓ ↓H␈↓                IN POSITION <stable position>  {optional}

␈↓ ↓H␈↓        GRASP <object> AT <trans or frame>

␈↓ ↓H␈↓        TIGHTEN <bolt or nut>
␈↓ ↓H␈↓                WITH TORQUE <number>  {this clause is required}

␈↓ ↓H␈↓        EXTRACT <shaft>  {the inverse of INSERT}







␈↓ ↓H␈↓␈↓∧4.5 WORLD MODELLING OVERVIEW␈↓

␈↓ ↓H␈↓The␈α
planning␈α
information␈α
required␈α
by␈α
the␈α
very␈αhigh␈α
level␈α
primitives␈α
is␈α
essentially␈α
a␈α
superset␈αof
␈↓ ↓H␈↓that␈αrequired␈αfor␈αthe␈αbasic␈αmanipulation␈αcontrol␈αstatements;␈αthe␈αsame␈αunderlying␈αmechanisms␈αare
␈↓ ↓H␈↓used,␈α∂although␈α∂sometimes␈α⊂in␈α∂slightly␈α∂different␈α∂ways.␈α⊂ This␈α∂includes␈α∂information␈α⊂about␈α∂variable
␈↓ ↓H␈↓semantics,␈αobject␈α
shape␈αand␈α
structure,␈αerror␈α
estimates,␈αand␈α
the␈αpurposes␈α
of␈αprograms,␈α
in␈αaddition
␈↓ ↓H␈↓to the simple planning values and attachment structures used for low-level trajectory planning.

␈↓ ↓H␈↓The␈α
expander␈αfrequently␈α
needs␈αto␈α
consider␈αthe␈α
effects␈αof␈α
some␈αhypothetical␈α
action␈αon␈α
a␈αnumber␈α
of
␈↓ ↓H␈↓program␈α∞steps.␈α∞ Similarly,␈α∞it␈α∞is␈α∞often␈α∂necessary␈α∞to␈α∞consider␈α∞the␈α∞effects␈α∞of␈α∞modifying␈α∂some␈α∞earlier
␈↓ ↓H␈↓decision␈α
or␈αto␈α
find␈αa␈α
way␈αto␈α
perform␈αsome␈α
preparatory␈α
action␈αat␈α
an␈αearly␈α
point␈αin␈α
a␈αprogram.␈α
 'AL
␈↓ ↓H␈↓handles␈α∞provides␈α∞for␈α∞this␈α∞sort␈α∞of␈α∞consideration␈α∂by␈α∞the␈α∞use␈α∞of␈α∞a␈α∞simple␈α∞"multi-world"␈α∂data␈α∞base.
␈↓ ↓H␈↓Essentially,␈α∃all␈α∃fluent␈α∃information␈α∃(such␈α∃as␈α∀planning␈α∃values␈α∃of␈α∃variables,␈α∃assertions,␈α∃etc)␈α∀is
␈↓ ↓H␈↓associated␈α∞with␈α
a␈α∞set␈α∞of␈α
"world"␈α∞states␈α∞for␈α
which␈α∞it␈α
is␈α∞true.␈α∞ With␈α
every␈α∞program␈α∞statement,␈α
'AL
␈↓ ↓H␈↓then␈α⊂associates␈α⊂an␈α⊂"input␈α⊂world",␈α⊂which␈α⊂contains␈α⊂the␈α⊂planning␈α⊂model␈α⊂of␈α⊂the␈α⊂environment␈α⊂just
␈↓ ↓H␈↓Page 78␈α?␈α?␈α?␈α?␈α?␈α↓WORLD MODELLING OVERVIEW␈↓ $4.5



␈↓ ↓H␈↓before␈α
the␈αstatement␈α
gets␈α
executed,␈αand␈α
an␈α
"output␈αworld"␈α
which␈α
will␈αreflect␈α
the␈α
expected␈αeffects␈α
of
␈↓ ↓H␈↓the␈α∞statement␈α∂on␈α∞the␈α∂runtime␈α∞world.␈α∂ Normally,␈α∞these␈α∂two␈α∞"worlds"␈α∂can␈α∞be␈α∂the␈α∞same␈α∂when␈α∞only
␈↓ ↓H␈↓low-level␈α∪'AL␈α∪statements␈α∪are␈α∪involved,␈α∪since␈α∪such␈α∪statements␈α∪don't␈α∪usually␈α∪need␈α∀to␈α∪generate
␈↓ ↓H␈↓forward or backward references to other planning states.

␈↓ ↓H␈↓Although␈α⊃multiple␈α⊃worlds␈α⊃are␈α⊃primarily␈α⊃intended␈α∩for␈α⊃use␈α⊃by␈α⊃the␈α⊃expander,␈α⊃a␈α⊃user␈α∩can␈α⊃make
␈↓ ↓H␈↓explicit references to different worlds by using

␈↓ ↓H␈↓        IN <worldname>

␈↓ ↓H␈↓in␈α
ASSERT␈α
and␈α
DENY␈α∞statements␈α
and␈α
in␈α
the␈α∞various␈α
PLAN␈α
constructs.␈α
 The␈α∞plan-time␈α
atoms
␈↓ ↓H␈↓IWORLD␈αand␈αOWORLD␈αalways␈αcontain␈α'AL's␈αinternal␈αnames␈αfor␈αthe␈αcurrent␈αinput␈αand␈αoutput
␈↓ ↓H␈↓worlds, respectively.  For example,

␈↓ ↓H␈↓        ATOM w;
␈↓ ↓H␈↓        s ←← 1;
␈↓ ↓H␈↓        w←← (IWORLD);
␈↓ ↓H␈↓        :
␈↓ ↓H␈↓        PLAN IF (#(s)=1) IN #(w) THEN
␈↓ ↓H␈↓                s ←← 2;
␈↓ ↓H␈↓        Comment, now #(s)=2;

␈↓ ↓H␈↓Note: IN acts syntactically like a very high priority boolean binary operator, so that

␈↓ ↓H␈↓        #(a)=1 IN #(w1) ␈↓ε∨␈↓ #(b)=1 ∧ #(a)=2 IN #(w2)
␈↓ ↓H␈↓is equivalent to

␈↓ ↓H␈↓        (#(a)=1 IN #(w1)) ␈↓ε∨␈↓ ((#(b)=1 IN #(IWORLD) ∧ (#(a)=2 IN #(w2))






␈↓ ↓H␈↓␈↓∧4.6 INFORMATION ABOUT VARIABLES␈↓

␈↓ ↓H␈↓The␈α⊃system␈α∩must␈α⊃deal␈α∩with␈α⊃a␈α∩number␈α⊃of␈α⊃different␈α∩sorts␈α⊃of␈α∩information␈α⊃about␈α∩variables␈α⊃and
␈↓ ↓H␈↓variable values.  These include:

␈↓ ↓H␈↓␈↓ αH(1)␈↓β␈αMetaphysical␈α
value.␈↓␈αThe␈αmetaphysical␈α
value␈αof␈αa␈α
variable␈αis␈α
that␈αquantity
␈↓ ↓H␈↓␈↓ αHwhich␈α
the␈α∞variable␈α
is␈α
supposed␈α∞to␈α
represent.␈α
 Traditionally,␈α∞knowledge␈α
about
␈↓ ↓H␈↓␈↓ αHthe␈αmeaning␈αof␈αvariables␈αhas␈αbeen␈α
more␈αor␈αless␈αthe␈αexclusive␈αprovince␈α
of␈αthe
␈↓ ↓H␈↓␈↓ αHprogrammer.␈α
 For␈α
example,␈αlow␈α
level␈α
'AL␈α
constructs␈αdon't␈α
usually␈α
know␈αor␈α
care
␈↓ ↓H␈↓␈↓ αHwhat␈αsome␈αuser-declared␈αframe␈αvariable␈αreally␈αrepresents,␈αalthough␈αthe␈αsystem
␈↓ ↓H␈↓␈↓ αHdoes␈αunderstand␈αa␈αfew␈αpredeclared␈αvariables␈α(e.g.,␈αYELLOW,␈αwhich␈αgives␈αthe
␈↓ ↓H␈↓␈↓ αHlocation␈α⊃of␈α⊃the␈α⊃yellow␈α⊃arm).␈α⊃ On␈α⊂the␈α⊃other␈α⊃hand,␈α⊃a␈α⊃statement␈α⊃like␈α⊃"fit␈α⊂the
␈↓ ↓H␈↓␈↓ αHpumphead␈α∞onto␈α∂the␈α∞pump␈α∂assembly"␈α∞requires␈α∞'AL␈α∂to␈α∞"know"␈α∂what␈α∞variables
␈↓ ↓H␈↓␈↓ αHrepresent object locations, mateing position, grasping positions, and so forth.
␈↓ ↓H␈↓4.6␈α?␈α?␈α?␈α?␈α?␈α_INFORMATION ABOUT VARIABLES␈↓ 
aPage 79



␈↓ ↓H␈↓␈↓ αH(2)␈↓β␈α∞Runtime␈α
Value.␈↓␈α∞This␈α
is␈α∞the␈α
value␈α∞that␈α
a␈α∞given␈α
variable␈α∞will␈α
have␈α∞at␈α
run
␈↓ ↓H␈↓␈↓ αHtime.␈α The␈αcompiler␈αhas␈αa␈αname␈αfor␈αit,␈αand␈αmust␈αgenerate␈αcode␈αthat␈αreferences
␈↓ ↓H␈↓␈↓ αHthe corresponding memory location(s).

␈↓ ↓H␈↓␈↓ αH(3)␈↓β␈α∪Locus␈α∪information.␈↓␈α∪Crudely␈α∪put,␈α∪the␈α∪locus␈α∪of␈α∪a␈α∪variable␈α∪is␈α∪the␈α∪set␈α∩of
␈↓ ↓H␈↓␈↓ αHpossible␈αruntime␈αvalues␈αfor␈αthat␈αvariable.␈αThe␈αterm␈αis␈αalso␈αused␈αhere␈αto␈αmean
␈↓ ↓H␈↓␈↓ αHthe␈α
compiler's␈α
estimate␈αof␈α
the␈α
locus.␈α
 This␈αestimate␈α
may␈α
merely␈α
be␈αthe␈α
planning
␈↓ ↓H␈↓␈↓ αHvalue,␈α∞or␈α
it␈α∞may␈α
include␈α∞a␈α
region␈α∞bounded␈α
by␈α∞constraints.␈α∞ These␈α
constraints
␈↓ ↓H␈↓␈↓ αHmay␈α⊂be␈α⊂expressed␈α⊂explicitly,␈α⊂as␈α⊂mathematical␈α⊂relations␈α⊂involving␈α⊃degrees␈α⊂of
␈↓ ↓H␈↓␈↓ αHfreedom,␈α∞or␈α∞implicitly,␈α∞as␈α∞semantic␈α∞information␈α∞like␈α∞"the␈α∞object␈α∞is␈α∞up␈α
against
␈↓ ↓H␈↓␈↓ αHthe wall."

␈↓ ↓H␈↓␈↓ αH(4)␈↓β␈αDetermination␈αinformation.␈↓␈αThe␈αdetermination␈αof␈αa␈αvariable␈αis␈αessentially␈αa
␈↓ ↓H␈↓␈↓ αHcompile-time␈α∀estimate␈α∀of␈α∪how␈α∀accurately␈α∀a␈α∪runtime␈α∀value␈α∀will␈α∀reflect␈α∪the
␈↓ ↓H␈↓␈↓ αHcorresponding␈αmetaphysical␈αvalue.␈α As␈αwith␈αthe␈αlocus,␈αthis␈αinformation␈αmay␈α
be
␈↓ ↓H␈↓␈↓ αHexpressed in a number of ways.

␈↓ ↓H␈↓For␈α
example,␈α
suppose␈α
we␈α
we␈α
want␈α
to␈α
compile␈α
code␈α
to␈α
pick␈α
up␈α
an␈α
object␈α
which␈α
we␈α
know␈α
will␈α
be
␈↓ ↓H␈↓sitting␈αupright␈αon␈α
the␈αtable.␈α In␈α
such␈αa␈αcase,␈α
the␈αobject␈αwill␈α
be␈αfree␈αto␈α
rotate␈αabout␈αthe␈αtable␈α
z-axis
␈↓ ↓H␈↓and␈αwill␈α
be␈αfree␈α
to␈αmove␈α
in␈αthe␈α
table␈αx-axis␈α&␈α
y-axis␈αdirections.␈α
 If␈αwe␈α
assume␈αthat␈α
the␈αtable␈αis␈α
15
␈↓ ↓H␈↓inches square, this might be translated by the system into something like:

␈↓ ↓H␈↓        ASSERT FORM ( LOCUS,obj,
␈↓ ↓H␈↓                EXPRESSION( FRAME( ROT(Z,theta),VECTOR(xdf,ydf,0)) ));

␈↓ ↓H␈↓        ASSERT xdf ␈↓ε≥␈↓ 0*INCHES; ASSERT xdf≤15*INCHES;
␈↓ ↓H␈↓        ASSERT ydf ␈↓ε≥␈↓ 0*INCHES; ASSERT ydf≤15*INCHES;
␈↓ ↓H␈↓        ASSERT theta ␈↓ε≥␈↓ -π*RAD; ASSERT theta ␈↓ε≤␈↓ π*RAD;

␈↓ ↓H␈↓where␈α"obj"␈αis␈αa␈αFRAME␈αvariable␈αgiving␈αthe␈αlocation␈αof␈αthe␈αobject,␈αand␈α"xdf",␈α"ydf",␈αand␈α"theta"
␈↓ ↓H␈↓represent the degrees of freedom.

␈↓ ↓H␈↓Of␈αcourse,␈αthere␈αmay␈αbe␈αadditional␈αconstraints␈αon␈αwhere␈αthe␈αobject␈αis.␈α For␈αinstance,␈αsuppose␈αthat
␈↓ ↓H␈↓the␈αobject␈αis␈αround␈αand␈αis␈αknown␈αto␈αhave␈αbeen␈αshoved␈αup␈αagainst␈αa␈αlow␈αwall␈αrunning␈αdiagonally
␈↓ ↓H␈↓across the table.  This might give us a constraint like:

␈↓ ↓H␈↓        ASSERT xdf+ydf=15*INCHES;

␈↓ ↓H␈↓so that the object locus is now given by

␈↓ ↓H␈↓        FRAME(ROT(Z,theta),VECTOR(xdf,ydf,0))   ␈↓ 
[[Eq. 4.1]
␈↓ ↓H␈↓        0≤xdf≤10
␈↓ ↓H␈↓        0≤ydf≤10
␈↓ ↓H␈↓        xdf+ydf=15
␈↓ ↓H␈↓        -π*RAD≤theta≤π*RAD

␈↓ ↓H␈↓If␈α
the␈αobject␈α
had␈α
a␈αflat␈α
side␈α
known␈αto␈α
be␈α
shoved␈αup␈α
against␈α
the␈αwall,␈α
then␈α
we␈αcould␈α
also␈αpin␈α
down
␈↓ ↓H␈↓theta to some fixed value, such as
␈↓ ↓H␈↓Page 80␈α?␈α?␈α?␈α?␈α/INFORMATION ABOUT VARIABLES␈↓ $4.6



␈↓ ↓H␈↓        theta ←← 0.75*π*RAD

␈↓ ↓H␈↓Suppose␈αthat␈αwe␈αnow␈αcall␈αa␈αvision␈αroutine␈αto␈αlocate␈αthe␈αobject␈αto␈αwithin␈αone␈αcentimeter␈αand␈αthree
␈↓ ↓H␈↓degrees.  The vision routine will store some value, say

␈↓ ↓H␈↓        FRAME(ROT(Z,90),VECTOR(10,5,0))

␈↓ ↓H␈↓into␈α⊂the␈α⊂value␈α⊂cell␈α⊂for␈α⊃obj.␈α⊂ We␈α⊂clearly␈α⊂cannot␈α⊂know␈α⊂in␈α⊃advance␈α⊂that␈α⊂this␈α⊂will␈α⊂be␈α⊃that␈α⊂value
␈↓ ↓H␈↓returned,␈αso␈α
the␈αlocus␈αestimate␈α
given␈αby␈α
Equation␈α4.1␈αwill␈α
remain␈αunchanged.␈α
 On␈αthe␈αother␈α
hand,
␈↓ ↓H␈↓the␈αdetermination␈αof␈αobj␈αhas␈αbeen␈αimproved␈αto␈αthe␈αpoint␈αwhere␈αthe␈αobject␈αcan␈αbe␈αpicked␈αup.␈α In
␈↓ ↓H␈↓other words, if we execute the statement

␈↓ ↓H␈↓        MOVE YELLOW TO obj*objgrasp

␈↓ ↓H␈↓then␈α
we␈α
know␈α
that␈α
the␈α
yellow␈α
arm␈α
will␈α
wind␈α
up␈α
sufficiently␈α
close␈α
to␈α
the␈α
nominal␈α
grasping␈α
point␈α
for
␈↓ ↓H␈↓the␈αobject␈αfor␈αthe␈αpicking-up␈αoperation␈αto␈αsucceed.␈α
 In␈αplanning␈αa␈αtrajectory␈αto␈αdo␈αthis,␈αthe␈α
system
␈↓ ↓H␈↓will␈α
use␈α
its␈αnominal␈α
value␈α
for␈αobj,␈α
which␈α
(in␈αthe␈α
absence␈α
of␈αany␈α
better␈α
advice)␈αwill␈α
be␈α
chosen␈αat
␈↓ ↓H␈↓the center of the locus,

␈↓ ↓H␈↓        FRAME(NILROT,VECTOR(7.5,7.5,0) )

␈↓ ↓H␈↓and then modified at runtime in the usual way.

␈↓ ↓H␈↓This␈αtrajectory␈α
modification␈αmay␈αcause␈α
problems␈αif␈αthe␈α
runtime␈αvalue␈α
of␈αobj␈αgets␈α
too␈αfar␈αfrom␈α
the
␈↓ ↓H␈↓nominal␈α⊂value.␈α⊃To␈α⊂avoid␈α⊃this,␈α⊂the␈α⊃expander␈α⊂will␈α⊂ask␈α⊃the␈α⊂trajectory␈α⊃calculator␈α⊂to␈α⊃evaluate␈α⊂the
␈↓ ↓H␈↓suitability␈αof␈αits␈αtrajectory␈αfor␈αextreme␈αpoints␈αof␈αthe␈αlocus␈αof␈αobj.␈α If␈αthe␈αmodification␈αseems␈αto␈αbe
␈↓ ↓H␈↓too␈α⊂great,␈α⊂then␈α⊂the␈α⊂expander␈α∂will␈α⊂ask␈α⊂for␈α⊂several␈α⊂trajectories␈α∂to␈α⊂be␈α⊂planned␈α⊂and␈α⊂will␈α∂generate
␈↓ ↓H␈↓conditional␈α∂tests␈α∂to␈α∂select␈α⊂the␈α∂correct␈α∂one.␈α∂We␈α∂are␈α⊂currently␈α∂investigating␈α∂ways␈α∂to␈α⊂facilitate␈α∂this
␈↓ ↓H␈↓communication␈α⊃between␈α⊃the␈α⊃expander␈α⊃and␈α∩the␈α⊃trajectory␈α⊃calculator.␈α⊃One␈α⊃very␈α∩simple,␈α⊃though
␈↓ ↓H␈↓painstaking,␈α
method␈α
is␈α
to␈α
simulate␈α
moves␈α
to␈α
a␈α∞number␈α
of␈α
spots.␈α
 A␈α
better␈α
way␈α
would␈α
be␈α∞for␈α
the
␈↓ ↓H␈↓trajectory␈αcalculator␈αto␈αgenerate␈αconstraints␈αtelling␈αwhat␈αregions␈α
a␈αtrajectory␈αis␈αgood␈αfor,␈αbut␈αit␈αis␈α
a
␈↓ ↓H␈↓bit␈α
too␈α∞early␈α
yet␈α
to␈α∞tell␈α
how␈α
feasible␈α∞this␈α
will␈α
be.␈α∞ Similarly,␈α
we␈α
are␈α∞investigating␈α
ways␈α∞for␈α
using
␈↓ ↓H␈↓runtime errors to determine when splitting of a region may be needed.





␈↓ ↓H␈↓␈↓∧4.7 OBJECT DESCRIPTION␈↓

␈↓ ↓H␈↓This␈α
section␈α
is␈αintended␈α
to␈α
provide␈αan␈α
overview␈α
of␈αthe␈α
sorts␈α
of␈αinformation␈α
about␈α
objects␈αthat␈α
'AL
␈↓ ↓H␈↓uses␈αand␈αof␈αhow␈αthis␈αinformation␈αis␈αcurrently␈αspecified.␈α It␈αis␈αnot␈αintended␈αto␈αbe␈αa␈αcomplete␈αlist␈αof
␈↓ ↓H␈↓␈↓βall␈↓ the assertions currently used or as a user's manual for building object descriptions.

␈↓ ↓H␈↓Our␈α∂primary␈α∂interest␈α∂so␈α∂far␈α∂has␈α∂been␈α∂to␈α∂investigate␈α∂ways␈α∂to␈α∂use␈α∂descriptive␈α∂information␈α∞about
␈↓ ↓H␈↓objects,␈αrather␈αthan␈αto␈αprovide␈αan␈αextremely␈αelegant␈αinput␈αlanguage␈αfor␈αthe␈αdescriptions.␈αThis␈αhas
␈↓ ↓H␈↓led␈α
us␈α
to␈α
specify␈α
explicitly␈α
a␈α
number␈α
of␈α
things␈α
which␈α
are,␈α
in␈α
principle,␈α
computable␈α
from␈α∞a␈α
more
␈↓ ↓H␈↓general␈α∞shape␈α∂description.␈α∞We␈α∂expect␈α∞that␈α∞the␈α∂process␈α∞of␈α∂describing␈α∞an␈α∞object␈α∂to␈α∞'AL,␈α∂which␈α∞is
␈↓ ↓H␈↓4.7␈α?␈α?␈α?␈α?␈α?␈α?␈α;OBJECT DESCRIPTION␈↓ 
aPage 81



␈↓ ↓H␈↓currently␈α
almost␈α
completely␈α
manual,␈α
will␈α
eventually␈α
become␈α
very␈α
largely␈α
automated,␈α
with␈α
most␈αof
␈↓ ↓H␈↓the␈α
information␈αbeing␈α
either␈αdirectly␈α
available␈αor␈α
computed␈αfrom␈α
the␈αoutput␈α
of␈αcomputer-aided-
␈↓ ↓H␈↓design programs.

␈↓ ↓H␈↓Currently,␈αobjects␈αare␈αdescribed␈αby␈αassertions␈αabout␈αtheir␈α"interesting"␈αproperties.␈αThese␈αassertions
␈↓ ↓H␈↓follow␈α
a␈αnumber␈α
of␈αconventions,␈α
so␈αthat␈α
the␈αvarious␈α
high␈αlevel␈α
primitives␈αcan␈α
use␈αthe␈α
information,
␈↓ ↓H␈↓although␈αa␈αuser␈αcan,␈αof␈αcourse␈αmanipulate␈αit␈αexplicitly.␈α Shape␈αis␈αtreated␈αsimply␈αas␈αanother␈αobject
␈↓ ↓H␈↓attribute, and a several different shape descriptions may be present for a given object.



␈↓ ↓H␈↓␈↓β4.7.1 ONE-PIECE OBJECTS␈↓

␈↓ ↓H␈↓Objects␈α⊃are␈α⊃represented␈α⊃as␈α⊃tree-like␈α⊃structures;␈α⊃typically,␈α⊃the␈α⊃"root"␈α⊃node␈α⊃contains␈α⊃information
␈↓ ↓H␈↓about␈αthe␈α
object␈αas␈αa␈α
whole,␈αwith␈α
"leaf"␈αnodes␈αtelling␈α
about␈αinteresting␈α
features.␈αBy␈αconvention,␈α
we
␈↓ ↓H␈↓use␈α⊂a␈α⊂frame␈α⊂variable␈α⊂for␈α⊂the␈α⊂object␈α⊂name.␈α⊂(This␈α⊂variable␈α⊂is␈α⊂then␈α⊂assumed␈α⊂to␈α⊂give␈α⊃the␈α⊂object
␈↓ ↓H␈↓location).

␈↓ ↓H␈↓For example,
␈↓ ↓H␈↓␈↓ αHFRAME valvebody,bore1,bore2,bore3;
␈↓ ↓H␈↓␈↓ αHPLANNING TRANS upright,upside_down;
␈↓ ↓H␈↓␈↓ αHPLANNING ROT idIrot;
␈↓ ↓H␈↓␈↓ αHPLANE topsurface;

␈↓ ↓H␈↓␈↓ αHupright ←← NILTRANS;
␈↓ ↓H␈↓␈↓ αHupside_down ←← TRANS(ROT(Y,π*RAD),VECTOR(0,0,1.8));

␈↓ ↓H␈↓␈↓ αHASSERT FORM(TYPE,valvebody,OBJECT);
␈↓ ↓H␈↓␈↓ αHASSERT FORM(GEOMED,valvebody,"valve.b3d");

␈↓ ↓H␈↓␈↓ αHASSERT FORM(SUBPART,valvebody,bore1);
␈↓ ↓H␈↓␈↓ αHASSERT FORM(SUBPART,valvebody,bore2);
␈↓ ↓H␈↓␈↓ αHASSERT FORM(SUBPART,valvebody,bore3);
␈↓ ↓H␈↓␈↓ αHASSERT FORM(SURFACE,valvebody,topsurface );

␈↓ ↓H␈↓␈↓ αHASSERT FORM(STABLE_POSITION,valvebody, (upright));
␈↓ ↓H␈↓␈↓ αHASSERT FORM(STABLE_POSITION,valvebody, (upside_down));

␈↓ ↓H␈↓␈↓ αHtopsurface <= PLANE(valvebody*VECTOR(0,0,1.8),Z WRT valvebody);

␈↓ ↓H␈↓␈↓ αHATTACH bore1 TO valvebody AT TRANS(NILROT,VECTOR(-1,0,2)) RIGIDLY;
␈↓ ↓H␈↓␈↓ αHATTACH bore2 TO valvebody AT TRANS(NILROT,VECTOR(1,0,2)) RIGIDLY;
␈↓ ↓H␈↓␈↓ αHATTACH bore3 TO valvebody AT TRANS(NILROT,VECTOR(1,0,3)) RIGIDLY;

␈↓ ↓H␈↓declares␈α
that␈α
"valvebody"␈α
is␈α
an␈α
object␈αwhose␈α
GEOMED␈α
description␈α
is␈α
given␈α
by␈α
file␈α"valve.b3d".
␈↓ ↓H␈↓There␈α∃are␈α∀three␈α∃interesting␈α∀"subparts",␈α∃called␈α∃"bore1",␈α∀"bore2",␈α∃and␈α∀"bore3"␈α∃and␈α∃located␈α∀at
␈↓ ↓H␈↓FRAME(NILROT,VECTOR(-1,0,2))␈α?␈α?␈αεFRAME(NILROT,VECTOR(1,0,2)),␈α?␈α?␈α¬and
␈↓ ↓H␈↓FRAME(NILROT,VECTOR(1,0,3)),␈α≤respectively.␈α≤ Also,␈α≥there␈α≤is␈α≤a␈α≤planar␈α≥surface␈α≤called
␈↓ ↓H␈↓Page 82␈α?␈α?␈α?␈α?␈α?␈α?␈α∪OBJECT DESCRIPTION␈↓ ∂4.7.1



␈↓ ↓H␈↓"topsurface"␈α
located␈α
at␈α
PLANE(1.8*Z,Z)␈α
in␈α
body␈αcoordinates.␈α
 The␈α
valvebody␈α
can␈α
sit␈α
on␈αthe␈α
station
␈↓ ↓H␈↓in two "stable positions", upright and upside_down.  Then, the assertion

␈↓ ↓H␈↓        ASSERT FORM(valvebody,ON_SURFACE,station, (upside_down))

␈↓ ↓H␈↓tells the system that the location of the valve body will be given by an expression of the form:

␈↓ ↓H␈↓        TRANS(ROT(Z,theta),VECTOR(a,b,0))* (upside_down)*station
␈↓ ↓H␈↓For degrees of freedom theta, a, & b.  This reduces to
␈↓ ↓H␈↓        FRAME(ROT(Z,theta'),VECTOR(a',b',1.8));

␈↓ ↓H␈↓where theta',a',& b' are another set of free scalar variables.

␈↓ ↓H␈↓The subparts, "bore1", "bore2", and "bore3" are further described by assertions of the form:

␈↓ ↓H␈↓␈↓ αHASSERT FORM(TYPE,bore1,BORE);
␈↓ ↓H␈↓␈↓ αHASSERT FORM(DIAMETER,bore1,0.9);
␈↓ ↓H␈↓␈↓ αHASSERT FORM(THREAD,bore1,32);
␈↓ ↓H␈↓␈↓ αHASSERT FORM(LENGTH,bore1,0.30);
␈↓ ↓H␈↓␈↓ αHASSERT FORM(TOP_END,bore1,hole1);
␈↓ ↓H␈↓␈↓ αHASSERT FORM(BOTTOM_END,bore1,OPEN);

␈↓ ↓H␈↓␈↓ αHASSERT FORM(TYPE,hole1,HOLE);
␈↓ ↓H␈↓␈↓ αHASSERT FORM(LIES_IN,hole1,topsurface);
␈↓ ↓H␈↓␈↓ αHASSERT FORM(CHAMFER_DEPTH,hole1,0);
␈↓ ↓H␈↓␈↓ αHASSERT FORM(CHAMFER_WIDTH,hole1,0);
␈↓ ↓H␈↓␈↓ αHASSERT FORM(LIP_SIZE,hole1,(3/16));

␈↓ ↓H␈↓␈↓ αH      { et cetera }

␈↓ ↓H␈↓Here␈αthe␈αsystem␈αrecognizes␈αthe␈αword␈α"BORE"␈αas␈αsaying␈αthat␈αbore1␈αis␈αa␈αnegative␈αcylinder␈α(such␈αas
␈↓ ↓H␈↓might␈α
result␈αfrom␈α
a␈α
drilling␈αoperation).␈α
 The␈α
attributes␈αDIAMETER,␈α
THREAD,␈α
and␈αLENGTH
␈↓ ↓H␈↓are␈α∞obvious.␈α∞ TOP_END␈α∞and␈α∞BOTTOM_END,␈α∞however,␈α∞may␈α∞require␈α∞a␈α∞bit␈α∂more␈α∞explanation.
␈↓ ↓H␈↓The␈α
"top␈α
end"␈α
of␈α
a␈α
bore␈α
is␈α
always␈α
a␈αhole␈α
--␈α
ie,␈α
an␈α
intersection␈α
between␈α
the␈α
bore␈α
and␈α
the␈αobject
␈↓ ↓H␈↓surface.␈α∂ If␈α∞the␈α∂bore␈α∞completely␈α∂pierces␈α∂the␈α∞object,␈α∂then␈α∞the␈α∂bottom␈α∂end␈α∞will␈α∂be␈α∞also␈α∂be␈α∂a␈α∞hole.
␈↓ ↓H␈↓Otherwise,␈α
it␈α∞may␈α
be␈α
"OPEN"␈α∞(which␈α
means␈α
that␈α∞it␈α
opens␈α
into␈α∞some␈α
uninteresting␈α∞cavity␈α
inside
␈↓ ↓H␈↓the␈αobject,␈α
"CLOSED"␈α(which␈α
means␈αthat␈α
it␈αcomes␈α
to␈αan␈α
abrupt,␈αbut␈α
otherwise␈αuninteresting,␈α
end),
␈↓ ↓H␈↓or a named surface (which usually only happens for relatively large holes). See Figure 4.1.

␈↓ ↓H␈↓Frequently,␈α∞a␈α∞user␈α∞wishes␈α∞to␈α
declare␈α∞a␈α∞number␈α∞of␈α∞instances␈α
of␈α∞a␈α∞single␈α∞prototype.␈α∞ This␈α∞may␈α
be
␈↓ ↓H␈↓done by making assertions of the form.

␈↓ ↓H␈↓        ASSERT FORM(TYPE,<object>,<prototype>)      .

␈↓ ↓H␈↓For instance,

␈↓ ↓H␈↓        ASSERT FORM(TYPE,s1,screwtype1);
␈↓ ↓H␈↓        ASSERT FORM(TYPE,s2,screwtype1);
␈↓ ↓H␈↓4.7.1␈α?␈α?␈α?␈α?␈α?␈α?␈α+OBJECT DESCRIPTION␈↓ 
aPage 83



␈↓ ↓H␈↓would declare s1 and s2 to be instances of screwtype1, where screwtype1 might be specified by

␈↓ ↓H␈↓        ASSERT FORM(TYPE,screwtype1,SHAFT);
␈↓ ↓H␈↓        ASSERT FORM(DIAMETER,screwtype1,0.62);
␈↓ ↓H␈↓        ASSERT FORM(LENGTH,screwtype1,2.44);
␈↓ ↓H␈↓        ASSERT FORM(THREAD,screwtype1,28);
␈↓ ↓H␈↓        ASSERT FORM(TOP_END,screwtype1,headtype1);
␈↓ ↓H␈↓        ASSERT FORM(BOTTOM_END,screwtype1,tiptype1);

␈↓ ↓H␈↓        ASSERT FORM(TYPE,headtype1,CYL_HEAD);
␈↓ ↓H␈↓        ASSERT FORM(SLOT,headtype1,HEX 0.53);

␈↓ ↓H␈↓        ASSERT FORM(TYPE,tiptype1,FLAT_END);

␈↓ ↓H␈↓Note␈α∂that␈α∂shafts␈α∂also␈α∂are␈α⊂considered␈α∂to␈α∂be␈α∂directed␈α∂and␈α⊂to␈α∂have␈α∂two␈α∂ends.␈α∂ By␈α⊂convention,␈α∂all
␈↓ ↓H␈↓screws, bolts, or similar objects are assumed to have their heads at the "top" end.  See Figure 4.2.
␈↓ ↓H␈↓Page 84␈α?␈α?␈α?␈α?␈α?␈α?␈α∪OBJECT DESCRIPTION␈↓ ∂4.7.1


















































␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈αβFigure  4.1
␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α≥Bores and Holes
␈↓ ↓H␈↓4.7.1␈α?␈α?␈α?␈α?␈α?␈α?␈α+OBJECT DESCRIPTION␈↓ 
aPage 85


















































␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈αβFigure  4.2
␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α Shafts
␈↓ ↓H␈↓Page 86␈α?␈α?␈α?␈α?␈α?␈α?␈α∪OBJECT DESCRIPTION␈↓ ∂4.7.1



␈↓ ↓H␈↓␈↓β4.7.2 ASSEMBLIES␈↓

␈↓ ↓H␈↓An "assembly" is an object whose various subparts are removable.

␈↓ ↓H␈↓For instance,

␈↓ ↓H␈↓        ASSERT FORM(TYPE,waterpump,ASSEMBLY);
␈↓ ↓H␈↓        ASSERT FORM(SUBPART,waterpump,gasket);
␈↓ ↓H␈↓        ASSERT FORM(SUBPART,waterpump,head);
␈↓ ↓H␈↓        ASSERT FORM(SUBPART,waterpump,pumpbase);
␈↓ ↓H␈↓         :
␈↓ ↓H␈↓        ASSERT FORM(gasket,FITS,ONTO,waterpump,
␈↓ ↓H␈↓                        AT,TRANS(NILROT,VECTOR(0,0,3)));
␈↓ ↓H␈↓         :

␈↓ ↓H␈↓Such␈α
objects␈α
provide␈α
a␈α
convenient␈α
framework␈α
for␈α
assembly␈α
tasks.␈α
 Typically,␈α
one␈α
of␈α
the␈α
subparts␈α
is
␈↓ ↓H␈↓chosen as a "base part", which is used as an anchor to which the remaining parts are added.

␈↓ ↓H␈↓In␈α⊃addition␈α⊃to␈α⊃the␈α⊃usual␈α⊃sorts␈α⊃of␈α⊂object␈α⊃attributes␈α⊃and␈α⊃the␈α⊃locations␈α⊃of␈α⊃the␈α⊃various␈α⊂subparts,
␈↓ ↓H␈↓assemblies␈αusually␈αcontain␈αa␈αnumber␈αof␈α"semantic"␈αassertions␈αabout␈αhow␈αthings␈αgo␈αtogether.␈α Some
␈↓ ↓H␈↓of this information is inherent in the design.  For instance,

␈↓ ↓H␈↓        ASSERT FORM(DESIGNED_TORQUE,screw1,40)

␈↓ ↓H␈↓Other␈α∀information␈α∀comes␈α∀from␈α∀the␈α∀geometry␈α∀of␈α∀the␈α∀parts,␈α∀and␈α∀(as␈α∀indicated␈α∀earlier)␈α∪could
␈↓ ↓H␈↓theoretically␈α∩be␈α∩computed␈α⊃from␈α∩the␈α∩shape␈α∩description␈α⊃but␈α∩is␈α∩of␈α⊃enough␈α∩interest␈α∩to␈α∩be␈α⊃worth
␈↓ ↓H␈↓representing␈α∪directly,␈α∩especially␈α∪in␈α∪cases␈α∩where␈α∪the␈α∪computation␈α∩required␈α∪is␈α∪non-trivial.␈α∩ For
␈↓ ↓H␈↓example,

␈↓ ↓H␈↓         :
␈↓ ↓H␈↓        ASSERT FORM(MATED,pumpbase.top_surf,gasket.bottom_surf)
␈↓ ↓H␈↓        ASSERT FORM(ALIGNED,head.bore1,gasket.bore1,pumpbase.bore1)
␈↓ ↓H␈↓        ASSERT FORM(RUNS_THRU,s1,gasket.bore1;
␈↓ ↓H␈↓        ASSERT FORM(RUNS_THRU,s1,head.bore1);
␈↓ ↓H␈↓        ASSERT FORM(SCREWED_INTO,s1,pumpbase.bore1);
␈↓ ↓H␈↓         :






␈↓ ↓H␈↓␈↓∧4.8 EXAMPLE: WATERPUMP ASSEMBLY PROGRAM␈↓

␈↓ ↓H␈↓This␈αshort␈αexample␈α
is␈αintended␈αto␈αgive␈α
some␈αfeel␈αfor␈α
what␈αa␈αvery␈αhigh␈α
level␈αprogram␈αfor␈αa␈α
simple
␈↓ ↓H␈↓task looks like.

␈↓ ↓H␈↓The␈αtask␈αhere␈αis␈αto␈αmate␈αthe␈αpump␈αhead␈αand␈αgasket␈αwith␈αthe␈αpump␈αbase␈αusing␈αtwo␈αaligning␈αpins,
␈↓ ↓H␈↓4.8␈α?␈α?␈α?␈α?␈α?␈α?␈α+WATERPUMP ASSEMBLY␈↓ 
aPage 87



␈↓ ↓H␈↓then␈αto␈αsecure␈αthe␈αhead␈αwith␈αsix␈αmachine␈αscrews.␈α This␈αtask␈αrequires␈αonly␈αa␈αfew␈αbasic␈αoperations,
␈↓ ↓H␈↓the␈α∪principle␈α∩ones␈α∪being␈α∩FIT␈α∪...␈α∩ONTO␈α∪and␈α∩INSERT,␈α∪and␈α∩is␈α∪very␈α∩similar␈α∪to␈α∪one␈α∩actually
␈↓ ↓H␈↓performed␈αby␈αWAVE␈αat␈αStanford.␈α The␈αWAVE␈αprogram␈αfor␈αthis␈αtask␈αconsists␈αof␈αabout␈α450␈αlines
␈↓ ↓H␈↓of␈α
"machine␈α
language"-like␈α
code,␈α
and␈α
was␈α
written␈α
over␈α
a␈α
period␈α
of␈α
several␈α
weeks␈α
by␈α
Bob␈αBolles
␈↓ ↓H␈↓and␈α∞Lou␈α∂Paul.␈α∞(Most␈α∞of␈α∂this␈α∞time␈α∞was␈α∂spent␈α∞on␈α∞improving␈α∂WAVE␈α∞and␈α∂developing␈α∞techniques;
␈↓ ↓H␈↓more␈αrecent␈αtasks␈αof␈αsimilar␈αcomplexity␈αhave␈αtaken␈αon␈αthe␈αorder␈αof␈αthree␈αto␈αeight␈αdays)␈αThe␈αsame
␈↓ ↓H␈↓program,␈αrewritten␈αin␈αlow-level␈α'AL,␈αwould␈αbe␈αsomewhat␈αshorter,␈αalthough␈αit␈αwould␈αstill␈αrequire␈αa
␈↓ ↓H␈↓fair amount of detailed effort on the part of the programmer.

␈↓ ↓H␈↓BEGIN "PUMP"

␈↓ ↓H␈↓REQUIRE "PUMP.075" SOURCE_FILE;

␈↓ ↓H␈↓␈↓ αλ␈↓β{This␈α→file␈α_would␈α→contain␈α_many␈α→assertions␈α_describing␈α→the␈α_pump␈α→assembly␈α_and␈α→all␈α_its
␈↓ ↓H␈↓β␈↓ αλsubparts.␈α_ Eventually,␈α_such␈α_descriptions␈α_will␈α_most␈α↔likely␈α_be␈α_produced␈α_as␈α_part␈α_of␈α↔the
␈↓ ↓H␈↓β␈↓ αλoutput␈α_of␈α_design␈α_automation␈α_programs.␈α→ See␈α_the␈α_section␈α_on␈α_object␈α_descriptions␈α→for␈α_a
␈↓ ↓H␈↓β␈↓ αλsampling of the sorts of things one might see here.}


␈↓ ↓H␈↓REQUIRE "STATN.04" SOURCE_FILE;

␈↓ ↓H␈↓␈↓ αλ␈↓β{Reads␈α↔in␈α⊗description␈α↔of␈α↔the␈α⊗work␈α↔station.␈α⊗This␈α↔would␈α↔include␈α⊗location␈α↔of␈α↔tool␈α⊗racks,
␈↓ ↓H␈↓β␈↓ αλstandard "jigs" that may be available, etc.}

␈↓ ↓H␈↓ASSERT FORM(pumpbase,ON_SURFACE,conveyor_belt, (upright));

␈↓ ↓H␈↓␈↓ αλ␈↓β{This␈α⊂assertion␈α⊃tells␈α⊂the␈α⊂strategist␈α⊃the␈α⊂initial␈α⊃location␈α⊂&␈α⊂"stable␈α⊃position"␈α⊂(ie␈α⊃"upright")␈α⊂of
␈↓ ↓H␈↓β␈↓ αλthe pumpbase.  The value of "upright" is assumed to be set up in "PUMP.075".
␈↓ ↓H␈↓β␈↓ αλThe␈α_dynamic␈α↔frame␈α_"conveyor_belt"␈α↔is␈α_assumed␈α↔to␈α_have␈α↔been␈α_defined␈α_in␈α↔"STATN.04".
␈↓ ↓H␈↓β␈↓ αλActually,␈α∩such␈α∩moving␈α∪devices␈α∩won't␈α∩be␈α∪handled␈α∩by␈α∩early␈α∪versions␈α∩of␈α∩'AL.␈α∪ An␈α∩alternative
␈↓ ↓H␈↓β␈↓ αλwould␈α⊃be␈α⊂to␈α⊃arrange␈α⊃the␈α⊂pumpbases␈α⊃in␈α⊃an␈α⊂array␈α⊃to␈α⊂one␈α⊃side␈α⊃of␈α⊂the␈α⊃work␈α⊃station␈α⊂(perhaps
␈↓ ↓H␈↓β␈↓ αλusing an "egg carton" arrangement to make it easier to pick one out).}

␈↓ ↓H␈↓ASSERT FORM(pumphead,ON_SURFACE,side_table, (onside));

␈↓ ↓H␈↓␈↓ αλ␈↓β{A number of other assertions might go here.}
␈↓ ↓H␈↓Page 88␈α?␈α?␈α?␈α?␈α?␈α?␈αβWATERPUMP ASSEMBLY␈↓ $4.8



␈↓ ↓H␈↓␈↓ αλ␈↓β{Here,␈α∩we␈α∪will␈α∩use␈α∪TASK␈α∩BEGINs␈α∪and␈α∩allow␈α∪the␈α∩system␈α∪to␈α∩decide␈α∪on␈α∩the␈α∪relative␈α∩order
␈↓ ↓H␈↓β␈↓ αλof the various subtasks.}

␈↓ ↓H␈↓aligning: TASK BEGIN

␈↓ ↓H␈↓        INSERT pin1 INTO pumpbase.hole1;
␈↓ ↓H␈↓        INSERT pin1 INTO pumpbase.hole2

␈↓ ↓H␈↓     END aligning;

␈↓ ↓H␈↓␈↓ βλ␈↓β{Note␈α⊗here␈α∃that␈α⊗we␈α⊗are␈α∃allowing␈α⊗the␈α⊗system␈α∃to␈α⊗decide␈α⊗how␈α∃it␈α⊗will␈α⊗locate␈α∃the
␈↓ ↓H␈↓β␈↓ βλpumpbase␈α_and␈α_whether␈α_it␈α_will␈α_leave␈α↔it␈α_on␈α_the␈α_conveyor␈α_belt␈α_throughout␈α↔the
␈↓ ↓H␈↓β␈↓ βλassembly␈α∀or␈α∀place␈α∀it␈α∀in␈α∀some␈α∀temporary␈α∀work␈α∀area.␈α∀ Of␈α∀course,␈α∀we␈α∀could␈α∪have
␈↓ ↓H␈↓β␈↓ βλmade these decisions explicitly.  For instance,
␈↓ ↓H␈↓␈↓ αλ                PLACE pumpbase ON station
␈↓ ↓H␈↓␈↓ αλ                        IN POSITION upright
␈↓ ↓H␈↓␈↓ αλ                        WITH ALIGNMENT left_side AGAINST wall1,
␈↓ ↓H␈↓␈↓ αλ                                       back_end AGAINST wall2;
␈↓ ↓H␈↓␈↓ βλ␈↓βcould have been the first statement of the program.
␈↓ ↓H␈↓β␈↓ βλ"wall1"␈α∀&␈α∀"wall2"␈α∪are␈α∀low␈α∀walls␈α∪described␈α∀in␈α∀"STATN.04"␈α∪and␈α∀form␈α∀a␈α∪corner
␈↓ ↓H␈↓β␈↓ βλwhich␈α∪could␈α∪be␈α∪used␈α∪as␈α∪a␈α∩simple␈α∪jig.␈α∪ "left_side"␈α∪&␈α∪"back_end"␈α∪here␈α∪would␈α∩be
␈↓ ↓H␈↓β␈↓ βλdefined␈α⊃in␈α⊂"PUMP.075"␈α⊃as␈α⊃components␈α⊂in␈α⊃the␈α⊃"footprint"␈α⊂of␈α⊃the␈α⊃pumpbase.␈α⊂ See
␈↓ ↓H␈↓β␈↓ βλthe section on object description for further details.}

␈↓ ↓H␈↓FIT gasket ONTO pumpbase_assembly
␈↓ ↓H␈↓        WITH ALIGNMENT gasket.hole1 OVER pin1,
␈↓ ↓H␈↓                       gasket.hole2 OVER pin2;

␈↓ ↓H␈↓␈↓ βλ␈↓β{The␈α∩system␈α∪uses␈α∩its␈α∩object␈α∪model␈α∩for␈α∩the␈α∪pumpbase␈α∩assembly␈α∩to␈α∪tell␈α∩it␈α∪how␈α∩the
␈↓ ↓H␈↓β␈↓ βλgasket fits onto the pumpbase.}

␈↓ ↓H␈↓FIT pumphead ONTO pumpbase_assembly
␈↓ ↓H␈↓        WITH ALIGNMENT head.hole1 OVER pin1,
␈↓ ↓H␈↓                       head.hole2 OVER pin2;

␈↓ ↓H␈↓boltdown: TASK BEGIN
␈↓ ↓H␈↓        LABEL s1op,s2op,s3op,s4op,s5op,s6op,p1_out,p2_out;

␈↓ ↓H␈↓s3op:   INSERT s3 INTO head.hole3
␈↓ ↓H␈↓                WITH TOOL driver1,
␈↓ ↓H␈↓                WITH TORQUE hand_tight;
␈↓ ↓H␈↓        END;

␈↓ ↓H␈↓s4op:   INSERT s4 INTO head.hole4
␈↓ ↓H␈↓                WITH TOOL driver1,
␈↓ ↓H␈↓                WITH TORQUE hand_tight;
␈↓ ↓H␈↓4.8␈α?␈α?␈α?␈α?␈α?␈α?␈α+WATERPUMP ASSEMBLY␈↓ 
aPage 89



␈↓ ↓H␈↓s5op:   INSERT s5 INTO head.hole5
␈↓ ↓H␈↓                WITH TOOL driver1,
␈↓ ↓H␈↓                WITH TORQUE hand_tight;

␈↓ ↓H␈↓s6op:   INSERT s6 INTO head.hole6
␈↓ ↓H␈↓                WITH TOOL driver1,
␈↓ ↓H␈↓                WITH TORQUE hand_tight;

␈↓ ↓H␈↓p1_out: INSERT pin1 INTO rack.hole1;
␈↓ ↓H␈↓        PREREQUISITE OF p1_out IS s3op;
␈↓ ↓H␈↓␈↓ βλ␈↓β{Once␈α∩we␈α∪have␈α∩s3␈α∩in␈α∪h3,␈α∩then␈α∩we␈α∪can␈α∩remove␈α∩pin1␈α∪without␈α∩fear␈α∩of␈α∪letting␈α∩the
␈↓ ↓H␈↓β␈↓ βλhead␈α∩slip␈α∩out␈α∩of␈α∩alignment,␈α⊃since␈α∩pin2␈α∩will␈α∩stay␈α∩until␈α⊃there␈α∩is␈α∩a␈α∩screw␈α∩in␈α⊃hole
␈↓ ↓H␈↓β␈↓ βλ4.}

␈↓ ↓H␈↓p2_out: INSERT pin2 INTO rack.hole2;
␈↓ ↓H␈↓        PREREQUISITE OF p2_out IS s4op;

␈↓ ↓H␈↓s1op:   INSERT s1 INTO head.hole1
␈↓ ↓H␈↓                WITH TOOL driver1,
␈↓ ↓H␈↓                WITH TORQUE hand_tight;
␈↓ ↓H␈↓        PREREQUISITE OF s1op IS p1_out;

␈↓ ↓H␈↓s2op:   INSERT s2 INTO head.hole2
␈↓ ↓H␈↓                WITH TOOL driver1,
␈↓ ↓H␈↓                WITH TORQUE hand_tight;
␈↓ ↓H␈↓        PREREQUISITE OF s1op IS p1_out;

␈↓ ↓H␈↓     END boltdown;
␈↓ ↓H␈↓Page 90␈α?␈α?␈α?␈α?␈α?␈α?␈αβWATERPUMP ASSEMBLY␈↓ $4.8



␈↓ ↓H␈↓torque_head: TASK BEGIN

␈↓ ↓H␈↓        PLAN FOREACH FORM(SUBPART,pump_assembly,BIND(s)) DO
␈↓ ↓H␈↓                PLAN IF FORM(TYPE,#(s),screwtype1)
␈↓ ↓H␈↓                     ∧ FORM(#(s),designed_torque,BIND(t))) THEN
␈↓ ↓H␈↓                        TIGHTEN #(s) WITH TORQUE #(t)
␈↓ ↓H␈↓                                WITH TOOL driver1;

␈↓ ↓H␈↓     END torque_head;

␈↓ ↓H␈↓␈↓ βλ␈↓β{This␈α~will␈α~tighten␈α~all␈α~subparts␈α≠of␈α~the␈α~pump␈α~assembly␈α~which␈α~are␈α≠of␈α~type
␈↓ ↓H␈↓β␈↓ βλ"screwtype1"␈α≥and␈α≥have␈α≥a␈α≥specified␈α≤design␈α≥torque.␈α≥ It␈α≥might␈α≥expand␈α≤into
␈↓ ↓H␈↓β␈↓ βλsomething like:

␈↓ ↓H␈↓␈↓ αH        torque_head: TASK BEGIN
␈↓ ↓H␈↓␈↓ αH                TIGHTEN s1 WITH TORQUE t1 WITH TOOL driver1;
␈↓ ↓H␈↓␈↓ αH                TIGHTEN s2 WITH TORQUE t2 WITH TOOL driver1;
␈↓ ↓H␈↓␈↓ αH                :
␈↓ ↓H␈↓␈↓ αH                TIGHTEN s6 WITH TORQUE t6 WITH TOOL driver1;
␈↓ ↓H␈↓␈↓ αH                END torque_head;
␈↓ ↓H␈↓␈↓ αH        }

␈↓ ↓H␈↓PLACE pump_assembly ON conveyor_belt IN POSITION upright;

␈↓ ↓H␈↓␈↓ αλ␈↓β{This␈α∪will␈α∪cause␈α∀the␈α∪system␈α∪to␈α∀pick␈α∪an␈α∪orientation␈α∪for␈α∀the␈α∪completed␈α∪pump␈α∀assembly␈α∪&
␈↓ ↓H␈↓β␈↓ αλput␈α∩it␈α∩on␈α∩the␈α∩conveyor.␈α∩ The␈α∩system␈α∪can,␈α∩of␈α∩course,␈α∩"remember"␈α∩the␈α∩position␈α∩it␈α∪picks.␈α∩ If
␈↓ ↓H␈↓β␈↓ αλthere␈α∀were␈α∀some␈α∃further␈α∀task␈α∀to␈α∃be␈α∀done␈α∀on␈α∃the␈α∀pump,␈α∀the␈α∃system␈α∀will␈α∀know␈α∃where␈α∀to
␈↓ ↓H␈↓β␈↓ αλfind it.}
␈↓ ↓H␈↓END;
␈↓ ↓H␈↓4.8␈α?␈α?␈α?␈α?␈α?␈α?␈α+WATERPUMP ASSEMBLY␈↓ 
aPage 91


















































␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈αβFigure  4.3
␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α,Pump Assembly Station
␈↓ ↓H␈↓Page 92␈α?␈α?␈α?␈α?␈α?␈α?␈αβWATERPUMP ASSEMBLY␈↓ $4.8



␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α0␈↓∧CHAPTER 5␈↓
␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α/␈↓¬RUNTIME OVERVIEW␈↓

␈↓ ↓H␈↓The␈αruntime␈αis␈αa␈αset␈αof␈αprograms␈αresiding␈αin␈αthe␈αPDP-11.␈αWe␈αwill␈αdiscuss␈αcontrol␈αstructures␈αand
␈↓ ↓H␈↓data structures.





␈↓ ↓H␈↓␈↓∧5.1 CONTROL STRUCTURES␈↓

␈↓ ↓H␈↓There are several types of processes any number of which can be active at any time:

␈↓ ↓H␈↓        1) Interpreters
␈↓ ↓H␈↓        2) Joint servos
␈↓ ↓H␈↓        3) Condition monitors


␈↓ ↓H␈↓An␈α␈↓βinterpreter␈↓␈αis␈αa␈αprocess␈αwhich␈α
is␈αexecuting␈αarithmetic␈αor␈αother␈αstack-oriented␈α
instructions,␈αnot
␈↓ ↓H␈↓one␈αof␈α
the␈αmoves.␈α
Most␈αstraightforward␈α
'AL␈αcode␈α
is␈αexecuted␈α
by␈αinterpreters.␈α
 During␈αexecution␈α
of
␈↓ ↓H␈↓simultaneous␈αblocks,␈αor␈αwhile␈αthe␈αconclusion␈αof␈αa␈αcondition␈αmonitor␈αis␈αrunning,␈αthere␈αcan␈αbe␈αmore
␈↓ ↓H␈↓than one interpreter.

␈↓ ↓H␈↓Each␈αactive␈αinterpreter␈αhas␈αa␈αstack␈αon␈αwhich␈αit␈αplaces␈αoperands,␈αa␈αprogram␈αcounter␈αwhich␈αpoints
␈↓ ↓H␈↓to␈α
its␈α
particular␈αblock␈α
of␈α
code,␈αand␈α
a␈α
list␈α
of␈αthose␈α
condition␈α
monitors␈αfor␈α
which␈α
it␈α
is␈αresponsible.
␈↓ ↓H␈↓Each␈α∂interpreter␈α⊂also␈α∂has␈α⊂a␈α∂reserved␈α⊂cell␈α∂in␈α∂which␈α⊂it␈α∂stores␈α⊂information␈α∂concerning␈α⊂its␈α∂current
␈↓ ↓H␈↓location␈α∞in␈α∞the␈α
source␈α∞code;␈α∞this␈α
is␈α∞useful␈α∞for␈α
debugging.␈α∞ The␈α∞code␈α
which␈α∞it␈α∞interprets␈α
includes
␈↓ ↓H␈↓instructions␈αfor␈αstack␈αmanipulation,␈αarithmetic␈αoperations,␈αstarting␈αup␈αsubsidiary␈αinterpreters,␈αflow
␈↓ ↓H␈↓of␈α
program␈α
control,␈α∞and␈α
preparation␈α
for␈α
motions.␈α∞ As␈α
soon␈α
as␈α
a␈α∞move␈α
is␈α
encountered,␈α∞the␈α
active
␈↓ ↓H␈↓interpreter␈α⊗starts␈α∃up␈α⊗the␈α∃required␈α⊗joint␈α∃servos␈α⊗and␈α∃condition␈α⊗monitors␈α∃and␈α⊗waits␈α⊗for␈α∃the
␈↓ ↓H␈↓termination of the move before continuing.

␈↓ ↓H␈↓A␈α∞␈↓βjoint␈α∞servo␈↓␈α
is␈α∞a␈α∞process␈α
whose␈α∞task␈α∞is␈α
to␈α∞servo␈α∞one␈α
joint␈α∞of␈α∞a␈α
moving␈α∞device␈α∞according␈α∞to␈α
the
␈↓ ↓H␈↓planned␈αtrajectory␈αfor␈αthat␈αjoint.␈α
 When␈αfinished,␈αthe␈αservo␈αstops␈α
the␈αjoint␈αand␈αdisappears.␈α If␈α
the
␈↓ ↓H␈↓motion␈α∂should␈α∂be␈α∞stopped␈α∂by␈α∂some␈α∞other␈α∂process,␈α∂the␈α∞servo␈α∂takes␈α∂care␈α∞of␈α∂actually␈α∂stopping␈α∞the
␈↓ ↓H␈↓joint␈α∞before␈α∞it␈α∞disappears.␈α∞ During␈α∞its␈α∞life,␈α∞the␈α∞servo␈α∞is␈α∞in␈α∞charge␈α∞of␈α∞applying␈α∞to␈α∞one␈α∞motor␈α
the
␈↓ ↓H␈↓correct␈α∩current,␈α∩which␈α∩will␈α∩change␈α∩over␈α∩time.␈α⊃ The␈α∩correct␈α∩signal␈α∩is␈α∩calculated␈α∩based␈α∩on␈α⊃the
␈↓ ↓H␈↓planned␈α∞location␈α∞of␈α∞the␈α∞joint,␈α∞its␈α∂observed␈α∞location␈α∞and␈α∞velocity,␈α∞and␈α∞its␈α∞recent␈α∂positional␈α∞error.
␈↓ ↓H␈↓After␈α
emitting␈α
the␈α∞proper␈α
drive,␈α
the␈α
servo␈α∞precalculates␈α
as␈α
much␈α
as␈α∞it␈α
can␈α
for␈α
some␈α∞future␈α
time,
␈↓ ↓H␈↓when it will again modify the drive, and then waits for that future time to arrive.

␈↓ ↓H␈↓A␈α∞␈↓βcondition␈α∞monitor␈↓␈α∞is␈α∞a␈α∞process␈α∞which␈α
continually␈α∞checks␈α∞for␈α∞some␈α∞condition.␈α∞ If␈α∞that␈α
condition
␈↓ ↓H␈↓should␈αappear,␈αthen␈αthose␈αactions␈αspecified␈αby␈αthe␈αcompiler␈αas␈αcritical␈αare␈αdone␈αimmediately␈α(in␈αa
␈↓ ↓H␈↓non-interruptible␈α∩fashion);␈α∩for␈α∩the␈α∩rest,␈α∩the␈α∩monitor␈α∩starts␈α∩up␈α∩an␈α∩interpreter.␈α∩ The␈α⊃condition
␈↓ ↓H␈↓monitor␈αcan␈αbe␈αin␈αtwo␈αstates:␈αenabled␈αand␈αdisabled.␈α The␈αchecking␈αis␈αonly␈αdone␈αwhile␈αthe␈αmonitor
␈↓ ↓H␈↓is␈α∞enabled.␈α∞ A␈α∞monitor␈α
disappears␈α∞only␈α∞when␈α∞the␈α∞system␈α
kills␈α∞it.␈α∞ An␈α∞enabled␈α∞condition␈α
monitor
␈↓ ↓H␈↓can␈α
be␈αof␈α
two␈α
types:␈αhardware␈α
or␈α
software.␈αThe␈α
hardware␈α
type␈αis␈α
a␈α
true␈αinterrupt␈α
handler␈αthat␈α
can
␈↓ ↓H␈↓5.1␈α?␈α?␈α?␈α?␈α?␈α?␈α,CONTROL STRUCTURES␈↓ 
aPage 93



␈↓ ↓H␈↓react␈α
to␈α
some␈αhardware␈α
condition.␈α
 An␈α
example␈αof␈α
this␈α
is␈α
a␈αmonitor␈α
to␈α
detect␈α
something␈αhitting␈α
the
␈↓ ↓H␈↓touch␈α∞pads␈α∞on␈α∞the␈α∞fingers.␈α∞ The␈α∞software␈α∞type␈α
is␈α∞a␈α∞set␈α∞of␈α∞calculations␈α∞which␈α∞are␈α∞to␈α∞be␈α
repeated
␈↓ ↓H␈↓frequently,␈α⊃the␈α⊃result␈α⊃of␈α⊃which␈α⊃is␈α⊃a␈α⊃decision␈α⊃whether␈α⊃or␈α⊃not␈α⊃to␈α⊃trigger␈α⊃the␈α⊃conclusion␈α⊃of␈α⊂the
␈↓ ↓H␈↓monitor.

␈↓ ↓H␈↓These␈α
various␈αtypes␈α
of␈α
processes␈αare␈α
scheduled␈α
by␈αa␈α
combination␈α
of␈αpriority␈α
structure␈α
and␈αtime-
␈↓ ↓H␈↓slot␈α
request␈α
disciplines.␈α
 Joint␈α
servos␈α
are␈α
critical␈α
in␈α
the␈α
sense␈α
that␈α
the␈α
calculations␈α
they␈α
make␈αare
␈↓ ↓H␈↓highly␈αtime-dependent;␈α
they␈αmust␈αbe␈α
guaranteed␈αnot␈α
to␈αbe␈αinterrupted.␈α
 Therefore,␈αthey␈αoperate␈α
at
␈↓ ↓H␈↓a␈α∞very␈α∞high␈α∞software␈α∞priority.␈α
 Condition␈α∞monitors␈α∞are␈α∞less␈α∞critical,␈α
and␈α∞they␈α∞operate␈α∞at␈α∞a␈α
lower
␈↓ ↓H␈↓priority.␈α∂ Interpreters␈α∂run␈α∂at␈α∂the␈α∂lowest␈α∞priority.␈α∂ Both␈α∂joint␈α∂servos␈α∂and␈α∂condition␈α∂monitors␈α∞are
␈↓ ↓H␈↓tasks␈α∃which␈α∃need␈α∃to␈α∃be␈α∃awakened␈α⊗periodically.␈α∃ Therefore,␈α∃time␈α∃is␈α∃divided␈α∃into␈α⊗slots␈α∃one
␈↓ ↓H␈↓millisecond␈αwide.␈α One␈α
servo␈αand␈αany␈αnumber␈α
of␈αcondition␈αmonitors␈αcan␈α
reserve␈αa␈αtime␈αslot;␈α
when
␈↓ ↓H␈↓that␈α∂time␈α∞arrives,␈α∂the␈α∂servo␈α∞is␈α∂given␈α∂guaranteed␈α∞control,␈α∂and␈α∂when␈α∞it␈α∂terminates,␈α∂all␈α∞requesting
␈↓ ↓H␈↓condition␈α⊂monitors␈α⊃are␈α⊂allowed␈α⊃to␈α⊂use␈α⊃the␈α⊂time␈α⊃remaining␈α⊂in␈α⊃the␈α⊂slot.␈α⊃ After␈α⊂all␈α⊃these␈α⊂critical
␈↓ ↓H␈↓requests␈α∞are␈α∞satisfied,␈α∞any␈α∞running␈α∞interpreter␈α∞uses␈α
the␈α∞time␈α∞left␈α∞over␈α∞until␈α∞the␈α∞next␈α∞slot␈α
begins.
␈↓ ↓H␈↓Appendix␈α5␈αdescribes␈αthe␈α
instructions␈αavailable␈αto␈αthe␈α
interpreter,␈αthe␈αtables␈αemitted␈α
for␈αmotions,
␈↓ ↓H␈↓the nature of joint servos, and the priority interrupt and scheduling structure in greater detail.





␈↓ ↓H␈↓␈↓∧5.2 DATA STRUCTURES␈↓



␈↓ ↓H␈↓␈↓β5.2.1 VALUE CELLS␈↓

␈↓ ↓H␈↓Values␈α∂are␈α∞stored␈α∂in␈α∞cells;␈α∂each␈α∞datatype␈α∂has␈α∂its␈α∞own␈α∂format␈α∞for␈α∂the␈α∞value␈α∂cell.␈α∂ Floating␈α∞point
␈↓ ↓H␈↓numbers␈αare␈αused␈α
throughout.␈α Dimensions␈α(like␈α
time,␈αdistance)␈αare␈αnot␈α
kept␈αat␈αruntime;␈α
they␈αare
␈↓ ↓H␈↓purely for use in the compiler to make consistency checks.

␈↓ ↓H␈↓Scalars are stored as a single, floating point word.

␈↓ ↓H␈↓Vectors␈α∩are␈α⊃stored␈α∩in␈α⊃four␈α∩consecutive␈α∩words.␈α⊃ The␈α∩fourth␈α⊃entry␈α∩is␈α⊃usually␈α∩1;␈α∩the␈α⊃arithmetic
␈↓ ↓H␈↓routines␈αare␈αoptimized␈αfor␈αsuch␈αnormalized␈αvectors.␈α To␈αnormalize␈αa␈αvector,␈αdivide␈αeach␈αentry␈αby
␈↓ ↓H␈↓the fourth one.

␈↓ ↓H␈↓Planes␈α
are␈α
also␈α
stored␈α
in␈α
four␈α
words.␈α The␈α
first␈α
three␈α
represent␈α
an␈α
outward-facing␈α
normal,␈αand␈α
the
␈↓ ↓H␈↓last is the negative distance to the (table) origin.

␈↓ ↓H␈↓Frames␈α
are␈αstored␈α
as␈α
4x4␈αarrays,␈α
by␈α
columns.␈α In␈α
addition,␈α
there␈αare␈α
6␈α
words␈αset␈α
aside␈α
for␈αthe␈α
joint
␈↓ ↓H␈↓angles␈α
associated␈α
with␈α∞the␈α
frame,␈α
that␈α∞is,␈α
the␈α
angles␈α
necessary␈α∞for␈α
one␈α
of␈α∞the␈α
arms␈α
to␈α∞reach␈α
that
␈↓ ↓H␈↓point␈αin␈αspace.␈α There␈αare␈αa␈αfew␈αbits␈αto␈αtell␈αwhich␈αarm␈αis␈αmeant␈αand␈αwhether␈αthe␈αjoint␈αangles␈αare
␈↓ ↓H␈↓valid,␈αthat␈αis,␈αwhether␈αthey␈αhave␈αbeen␈α
calculated␈αsince␈αlast␈αthe␈αframe's␈αvalue␈αwas␈α
changed.␈α Joint
␈↓ ↓H␈↓angles␈α∞are␈α∞calculated␈α∞only␈α∞if␈α∞needed.␈α∞ This␈α∞happens␈α∞if␈α∞the␈α∞frame␈α∞is␈α∞being␈α∞used␈α∞as␈α∞a␈α∞point␈α∂in␈α∞a
␈↓ ↓H␈↓trajectory.
␈↓ ↓H␈↓Page 94␈α?␈α?␈α?␈α?␈α?␈α?␈α)DATA STRUCTURES␈↓ ∂5.2.1



␈↓ ↓H␈↓Transes are stored in two 4x4 arrays: One holds the trans itself, and the other its inverse.



␈↓ ↓H␈↓␈↓β5.2.2 GRAPH STRUCTURES␈↓

␈↓ ↓H␈↓Variables␈αare␈αallocated␈α"node␈αcells".␈α These␈αcells␈αhave␈αa␈αpointer␈αto␈αthe␈αvalue␈αcell,␈αas␈αwell␈αas␈αother
␈↓ ↓H␈↓fields used in graph structure manipulation.

␈↓ ↓H␈↓NODE CELL
␈↓ ↓H␈↓␈↓ αHinvmark␈α--␈α=0␈αif␈αvalue␈αis␈α
valid,␈αotherwise␈αinvalid␈α(note:␈αthe␈αevalnode␈αalgorithm␈α
uses␈αa
␈↓ ↓H␈↓␈↓ βH"time" to detect cycles.  Therefore, this field needs to be (at least) 16 bits.
␈↓ ↓H␈↓␈↓ αHvalue -- pointer to a value cell.
␈↓ ↓H␈↓␈↓ αHcalculator -- points to a list of calculator cells
␈↓ ↓H␈↓␈↓ αHchanger␈α⊂--␈α⊂points␈α∂to␈α⊂a␈α⊂block␈α∂of␈α⊂interpretable␈α⊂code.␈α∂There␈α⊂are␈α⊂a␈α⊂few␈α∂special-purpose
␈↓ ↓H␈↓␈↓ βHchangers which do not point to any code, but are used as shorthands.
␈↓ ↓H␈↓␈↓ αHdependents -- points to a list of dependents
␈↓ ↓H␈↓␈↓ αHtype -- encoding (in several bits) of datatype.

␈↓ ↓H␈↓CALCULATOR CELL
␈↓ ↓H␈↓␈↓ αHlink -- link to next on the chain (there can be more than one calculator for a node).
␈↓ ↓H␈↓␈↓ αHneeded␈α⊂--␈α⊂points␈α⊂to␈α⊂list␈α⊂of␈α⊂variables␈α⊂needed␈α⊂for␈α⊂this␈α⊂calculator.␈α⊂The␈α⊃dependents␈α⊂cell
␈↓ ↓H␈↓␈↓ βHformat is used for the needed list.
␈↓ ↓H␈↓␈↓ αHcode -- points to a block of interpretable code.

␈↓ ↓H␈↓DEPENDENTS CELL
␈↓ ↓H␈↓␈↓ αHlink -- link to next on the chain (there can be more than one dependent of a node).
␈↓ ↓H␈↓␈↓ αHdep -- points to the node cell of one dependent.

␈↓ ↓H␈↓The␈α∩algorithms␈α∪used␈α∩to␈α∪extract␈α∩values␈α∪from␈α∩and␈α∩insert␈α∪values␈α∩into␈α∪the␈α∩graph␈α∪structure␈α∩are
␈↓ ↓H␈↓described in Appendix II.
␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α0VISUAL FEEDBACK␈↓ 
aPage 95



␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α0␈↓∧CHAPTER 6␈↓
␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α9␈↓¬EXTENSIONS TO 'AL␈↓





␈↓ ↓H␈↓␈↓∧6.1 INCORPORATING VISUAL FEEDBACK␈↓



␈↓ ↓H␈↓␈↓β6.1.1 NECESSARY CAPABILITIES␈↓

␈↓ ↓H␈↓This␈αis␈αa␈αlist␈αof␈αcapabilities␈αwhich␈αwould␈αhave␈αto␈αbe␈αimplemented␈αin␈αorder␈αto␈αdo␈αdynamic␈αvisual
␈↓ ↓H␈↓feedback within 'AL.

␈↓ ↓H␈↓PICTURE BUFFERS AND WINDOWS

␈↓ ↓H␈↓We␈α∞need␈α∞a␈α
new␈α∞datatype,␈α∞PICTURE,␈α∞to␈α
contain␈α∞a␈α∞digitized␈α
picture,␈α∞information␈α∞on␈α∞the␈α
camera
␈↓ ↓H␈↓used␈α(particularly␈α
its␈αlocation␈α
and␈αorientation),␈αwhat␈α
lens␈αwas␈α
used,␈αwhat␈α
filters,␈αand␈αperhaps␈α
other
␈↓ ↓H␈↓information.

␈↓ ↓H␈↓Subpictures,␈α∩that␈α∪is␈α∩windows,␈α∪should␈α∩be␈α∪extractible␈α∩from␈α∩the␈α∪picture␈α∩itself,␈α∪so␈α∩that␈α∪a␈α∩visual
␈↓ ↓H␈↓processing routine can look at whatever part it needs.

␈↓ ↓H␈↓CAMERA CONTROL

␈↓ ↓H␈↓There␈α⊃should␈α⊃be␈α∩a␈α⊃syntax␈α⊃for␈α⊃specifying␈α∩how␈α⊃to␈α⊃move␈α⊃a␈α∩camera␈α⊃to␈α⊃a␈α⊃desired␈α∩location.␈α⊃ For
␈↓ ↓H␈↓example,

␈↓ ↓H␈↓        AIM CAMERA_1 AT VECTOR(30,40,10)
␈↓ ↓H␈↓                USING LENS=2, FILTER=CLEAR, IRIS=2.8;


␈↓ ↓H␈↓There␈α
should␈α
be␈α
a␈α
syntax␈α
for␈α
specifying␈α
that␈α∞a␈α
picture␈α
be␈α
taken␈α
and␈α
stored␈α
in␈α
a␈α∞certain␈α
picture
␈↓ ↓H␈↓buffer.␈α∞ Since␈α∂cameras␈α∞have␈α∞their␈α∂own␈α∞built-in␈α∞synchronization,␈α∂detailed␈α∞timing␈α∞control␈α∂may␈α∞be
␈↓ ↓H␈↓complicated.␈α∩ Read␈α∩the␈α∩␈↓βexplicit␈α∩control␈α∩of␈α∪timing␈↓␈α∩section␈α∩below␈α∩for␈α∩some␈α∩more␈α∩ideas␈α∪on␈α∩this
␈↓ ↓H␈↓subject.

␈↓ ↓H␈↓OBJECT MODELS

␈↓ ↓H␈↓There␈αshould␈αbe␈αsufficiently␈αpowerful␈αdata␈αstructures␈α(such␈αas␈αarrays␈αand␈αlist␈αstructures)␈αavailable
␈↓ ↓H␈↓to implement complex object descriptions such as a network of features.

␈↓ ↓H␈↓It␈α
should␈α∞be␈α
possible␈α∞to␈α
implement␈α
programs␈α∞which␈α
find␈α∞predicted␈α
objects␈α
in␈α∞pictures␈α
by␈α∞use␈α
of
␈↓ ↓H␈↓modeling␈α∞information.␈α∞ This␈α∞may␈α∞involve␈α∞the␈α∞use␈α
of␈α∞recursion␈α∞and␈α∞backup,␈α∞neither␈α∞of␈α∞which␈α
is
␈↓ ↓H␈↓currently available.
␈↓ ↓H␈↓Page 96␈α?␈α?␈α?␈α?␈α≡INCORPORATING VISUAL FEEDBACK␈↓ ∂6.1.1



␈↓ ↓H␈↓VISUAL PROCESSING PRIMITIVES

␈↓ ↓H␈↓There␈α
should␈αbe␈α
a␈α
mechanism␈αfor␈α
calling␈αPDP11␈α
and␈α
SPS41␈αroutines␈α
which␈αshare␈α
data␈α
such␈αas
␈↓ ↓H␈↓pictures␈αand␈αobject␈α
models.␈α (The␈αSPS41␈α
is␈αa␈αsignal␈α
processor␈αwhich␈αwe␈α
will␈αuse␈αfor␈α
some␈αvision
␈↓ ↓H␈↓work.) To an extent, this already exists with the EXTERNAL MINI procedure.

␈↓ ↓H␈↓MOTIONS OF ACCOMMODATION

␈↓ ↓H␈↓There␈α∞should␈α∂be␈α∞a␈α∞way␈α∂of␈α∞specifying␈α∞how␈α∂to␈α∞servo␈α∞an␈α∂arm␈α∞based␈α∞upon␈α∂visual,␈α∞force,␈α∂or␈α∞tactile
␈↓ ↓H␈↓information.␈α∂ The␈α∂arm␈α∞is␈α∂expected␈α∂to␈α∂change␈α∞its␈α∂trajectory␈α∂as␈α∂a␈α∞function␈α∂of␈α∂sensory␈α∂input;␈α∞this
␈↓ ↓H␈↓would␈α⊗allow␈α⊗visual␈α∃servoing,␈α⊗for␈α⊗example.␈α∃ An␈α⊗implementation␈α⊗would␈α⊗involve␈α∃dynamically
␈↓ ↓H␈↓changing␈α
the␈α
arm's␈α
destination␈α
or␈α
dynamically␈αspecifying␈α
relative␈α
changes␈α
to␈α
be␈α
made.␈α
 In␈αeither
␈↓ ↓H␈↓case, time is an important variable.  Consider a typical sequence of events:
␈↓ ↓H␈↓␈↓ αH(1) A picture is taken of the arm.
␈↓ ↓H␈↓␈↓ αH(2) The picture is analyzed to determine an arm correction.
␈↓ ↓H␈↓␈↓ αH(3)␈α⊂While␈α⊂the␈α⊂visual␈α⊂processing␈α⊃is␈α⊂being␈α⊂done,␈α⊂the␈α⊂arm␈α⊂continues␈α⊃to␈α⊂move.
␈↓ ↓H␈↓␈↓ αHHence␈α∀a␈α∀prediction␈α∀should␈α∀be␈α∀made␈α∀and␈α∀incorporated␈α∀into␈α∀the␈α∀specified
␈↓ ↓H␈↓␈↓ αHcorrection.
␈↓ ↓H␈↓␈↓ αH(4) The correction is sent to the servo.

␈↓ ↓H␈↓EXPLICIT CONTROL OF TIMING

␈↓ ↓H␈↓As␈αpointed␈αout␈αabove,␈αtime␈αis␈αan␈αimportant␈αfactor␈αwithin␈αvisual␈αfeedback.␈α It␈αwill␈αbe␈αnecessary␈αto
␈↓ ↓H␈↓have␈α"picture␈α
ready"␈αevents␈αwhich␈α
occur␈αwhen␈α
data␈αare␈αready␈α
for␈αprocessing;␈α
it␈αmight␈αbe␈α
desirable
␈↓ ↓H␈↓to allow explicit timing and scheduling to make efficient use of the camera.

␈↓ ↓H␈↓It␈αwould␈αalso␈αbe␈αuseful␈αto␈αseparate␈αthe␈α`setup'␈αfor␈αa␈αMOVE␈αfrom␈αthe␈αactual␈αbeginning␈αof␈αa␈αmove.
␈↓ ↓H␈↓This␈αsuggests␈αa␈α
setup␈αand␈αtrigger␈α
mechanism␈αto␈αsqueeze␈α
as␈αmuch␈αprocessing␈α
as␈αpossible␈αinto␈α
"free"
␈↓ ↓H␈↓PDP11 time.

␈↓ ↓H␈↓INTERACTIVE DESIGN OF VISUAL PROCESSING

␈↓ ↓H␈↓There␈α∀should␈α∀be␈α∃an␈α∀interface␈α∀to␈α∃a␈α∀graphics␈α∀system␈α∃such␈α∀as␈α∀Bruce␈α∃Baumgart's␈α∀GEOMED
␈↓ ↓H␈↓[Baumgart]␈α∞so␈α∞the␈α∞user␈α∞can␈α∞symbolically␈α
position␈α∞the␈α∞assembly␈α∞parts␈α∞and␈α∞cameras,␈α∞simulate␈α
arm
␈↓ ↓H␈↓motions,␈α∩and␈α∩extract␈α∪potential␈α∩object␈α∩models␈α∩from␈α∪synthetic␈α∩pictures.␈α∩ The␈α∪system␈α∩supervisor
␈↓ ↓H␈↓should␈α⊃be␈α⊃flexible␈α⊃enough␈α⊃to␈α⊃allow␈α⊃the␈α⊃user␈α⊃to␈α⊃interactively␈α⊃manipulate␈α⊃the␈α⊃actual␈α⊃arms␈α⊂and
␈↓ ↓H␈↓cameras␈α∂so␈α∂that␈α∂the␈α∂resulting␈α∂TV␈α⊂pictures␈α∂correspond␈α∂with␈α∂the␈α∂synthetic␈α∂views.␈α⊂ This␈α∂involves
␈↓ ↓H␈↓consistent models of the world.



␈↓ ↓H␈↓␈↓β6.1.2 STAGES IN INCORPORATING VISUAL FEEDBACK␈↓

␈↓ ↓H␈↓There␈αare␈αroughly␈αthree␈αdifferent␈αstages␈αin␈αthe␈αprocess␈αof␈αincorporating␈αvisual␈αfeedback␈αinto␈α'AL:
␈↓ ↓H␈↓(1)␈αcompletely␈αseparate␈αmodules,␈α(2)␈αpicture␈α
taking␈αwithin␈α'AL␈αbut␈αmodels␈αand␈αprocessing␈α
separate,
␈↓ ↓H␈↓and (3) everything in 'AL.  These stages are briefly discussed below.

␈↓ ↓H␈↓COMPLETELY SEPARATE MODULES
␈↓ ↓H␈↓6.1.2␈α?␈α?␈α?␈α?␈α6INCORPORATING VISUAL FEEDBACK␈↓ 
aPage 97



␈↓ ↓H␈↓This␈αmeans␈αthat␈αthe␈αobject␈αmodules,␈αinterpreters,␈αcamera␈αcontrol␈αroutines,␈αetc.␈αare␈αin␈αone␈αor␈αmore
␈↓ ↓H␈↓modules␈αand␈αthe␈α'AL␈αsystem␈αis␈αanother␈αmodule.␈α Communication␈αbetween␈αmodules␈αis␈αby␈αmessages.
␈↓ ↓H␈↓This␈αtype␈αof␈αcommunication␈αrestricts␈αthe␈αmode␈αof␈αoperation;␈αfeedback␈αwill␈αonly␈αbe␈αavailable␈αwhile
␈↓ ↓H␈↓the arm is not in motion.  Motions of accommodation would not be possible.

␈↓ ↓H␈↓The␈αcurrent␈αStanford␈αhand-eye␈αsystem␈αis␈αof␈αthis␈αform.␈α It␈αwill␈αbe␈αstraightforward␈αto␈αprovide␈αthis
␈↓ ↓H␈↓type␈α∂of␈α⊂system␈α∂with␈α⊂'AL.␈α∂ However,␈α∂it␈α⊂has␈α∂obvious␈α⊂limitations␈α∂and␈α∂hopefully␈α⊂would␈α∂only␈α⊂be␈α∂a
␈↓ ↓H␈↓temporary solution.

␈↓ ↓H␈↓PICTURE TAKING WITHIN 'AL

␈↓ ↓H␈↓This␈αis␈αthe␈αfirst␈αstep␈αtoward␈αa␈αcomplete␈αintegration.␈α 'AL␈αwould␈αprovide␈αcamera␈α
control,␈αpictures,
␈↓ ↓H␈↓picture␈αtaking,␈αand␈αways␈αto␈αcall␈αprocedures␈αwhich␈αshare␈αdata.␈α The␈αobject␈αmodels␈αcould␈αeither␈αbe
␈↓ ↓H␈↓written␈α∂in␈α⊂SAIL␈α∂(and␈α∂be␈α⊂on␈α∂the␈α⊂PDP10)␈α∂of␈α∂be␈α⊂written␈α∂in␈α⊂a␈α∂PDP11␈α∂language␈α⊂(and␈α∂be␈α⊂on␈α∂the
␈↓ ↓H␈↓PDP11).␈α∞ In␈α∞either␈α∞case␈α∞the␈α∞models␈α∂and␈α∞pictures␈α∞would␈α∞be␈α∞available␈α∞to␈α∞external␈α∂routines␈α∞which
␈↓ ↓H␈↓analyze␈α
pictures␈α
and␈α
return␈α
improved␈α∞location␈α
values␈α
for␈α
objects.␈α
 Visual␈α
servoing␈α∞and␈α
dynamic
␈↓ ↓H␈↓feedback␈αstill␈αcould␈αnot␈αbe␈αdone;␈αthere␈αis␈αno␈αway␈αto␈αcontrol␈αthe␈αscheduling␈αto␈αinsure␈αthe␈αnecessary
␈↓ ↓H␈↓service.

␈↓ ↓H␈↓This␈α
type␈α
of␈αprocedure-calling␈α
is␈α
designed␈α
into␈αthe␈α
current␈α
'AL␈α
system.␈α It␈α
mainly␈α
involves␈αa␈α
smart
␈↓ ↓H␈↓loader.␈α The␈αother␈αextensions␈αare␈αreasonably␈αstraightforward;␈α
it␈αappears␈αto␈αbe␈αan␈αeasy␈αstep␈α
up␈αto
␈↓ ↓H␈↓this␈α∂type␈α∂of␈α∂system.␈α∂ Its␈α∞advantage␈α∂over␈α∂the␈α∂previous␈α∂system␈α∞is␈α∂that␈α∂the␈α∂basic␈α∂requirements␈α∞for
␈↓ ↓H␈↓doing␈αvisual␈α
feedback␈αare␈α
all␈αdirectly␈α
accessible␈αfrom␈α
within␈αone␈α
system␈α(assuming␈α
the␈αroutines␈α
are
␈↓ ↓H␈↓on␈α
the␈α
PDP11).␈α
 This␈α
provides␈α
a␈α
chance␈α
to␈α
try␈αout␈α
some␈α
of␈α
the␈α
ideas␈α
before␈α
moving␈α
on␈α
to␈αthe␈α
next
␈↓ ↓H␈↓stage.

␈↓ ↓H␈↓COMPLETE INTEGRATION

␈↓ ↓H␈↓Complete␈α~integration␈α~would␈α~involve␈α≠motions␈α~of␈α~accommodation␈α~in␈α~full␈α≠generality,␈α~with
␈↓ ↓H␈↓modifications␈αto␈α
trajectories␈αwhile␈α
they␈αare␈αbeing␈α
executed.␈α Picture␈α
taking␈αand␈α
processing␈αwould
␈↓ ↓H␈↓all␈α⊂be␈α⊂run␈α∂under␈α⊂'AL,␈α⊂and␈α∂they␈α⊂would␈α⊂be␈α∂interfaced␈α⊂into␈α⊂the␈α∂timing␈α⊂scheme␈α⊂to␈α⊂insure␈α∂proper
␈↓ ↓H␈↓service.␈α Not␈αonly␈αwould␈αtrue␈αvisual␈αservoing␈αbe␈αpossible,␈αbut␈αalso␈αfine␈αcontrol␈αof␈αthe␈αhand␈αbased
␈↓ ↓H␈↓on delicate touch sensing.





␈↓ ↓H␈↓␈↓∧6.2 DYNAMIC FRAMES ␈↓

␈↓ ↓H␈↓One␈αvery␈αdesirable␈αfeature␈αwould␈αbe␈αan␈αability␈αto␈αdescribe␈αand␈αuse␈αcontinually␈αvarying␈αvariables.
␈↓ ↓H␈↓In␈α∃industrial␈α∃applications,␈α⊗for␈α∃instance,␈α∃the␈α∃runtime␈α⊗system␈α∃should␈α∃automatically␈α⊗make␈α∃the
␈↓ ↓H␈↓corrections␈α
required␈αto␈α
track␈α
an␈αobject␈α
on␈αa␈α
moving␈α
conveyor.␈α Initially,␈α
this␈αfacility␈α
is␈α
not␈αbeing
␈↓ ↓H␈↓implemented,␈α∂although␈α∂we␈α∂are␈α∂studying␈α∂the␈α∂problems␈α∂involved.␈α∂ Actually,␈α∂only␈α∂a␈α∂very␈α∂few␈α∞new
␈↓ ↓H␈↓constructs␈α∞would␈α∞need␈α∞to␈α∞be␈α∞introduced␈α∞into␈α∞the␈α∞language␈α∞to␈α∞allow␈α∞such␈α∞things␈α∞to␈α∂be␈α∞described.
␈↓ ↓H␈↓The␈α∞principal␈α∞addition␈α∞required␈α∞is␈α∞a␈α∞way␈α∞of␈α∞warning␈α∞the␈α∞compiler␈α∞that␈α∞some␈α∞variables␈α∂may␈α∞be
␈↓ ↓H␈↓␈↓βdynamic␈↓.  For instance,
␈↓ ↓H␈↓Page 98␈α?␈α?␈α?␈α?␈α?␈α?␈α/DYNAMIC FRAMES ␈↓ $6.2



␈↓ ↓H␈↓        DYNAMIC DISTANCE VECTOR v;
␈↓ ↓H␈↓        DYNAMIC FRAME chain_hoist;

␈↓ ↓H␈↓would␈αtell␈αthe␈αcompiler␈α
that␈αv␈αand␈αchain_hoist␈αmay␈α
vary␈αcontinuously␈αwith␈αtime.␈α
 Trajectories␈αto
␈↓ ↓H␈↓any␈α⊂locations␈α⊃that␈α⊂depend␈α⊃on␈α⊂such␈α⊂variables␈α⊃must␈α⊂be␈α⊃handled␈α⊂a␈α⊂bit␈α⊃differently␈α⊂by␈α⊃the␈α⊂servo.
␈↓ ↓H␈↓Instead␈α
of␈α
applying␈α
the␈α
brakes␈αat␈α
the␈α
end␈α
of␈α
a␈αMOVE,␈α
the␈α
servo␈α
should␈α
periodically␈αrecompute
␈↓ ↓H␈↓the destination location, obtain a new arm solution, and then servo to the new joint values.

␈↓ ↓H␈↓The␈αnormal␈α'AL␈αgraph␈αstructures␈αare␈αreadily␈α
adapted␈αto␈αsuch␈αdynamic␈αvalues.␈α Essentially␈αall␈α
that
␈↓ ↓H␈↓is␈α∞required␈α∞is␈α
the␈α∞addition␈α∞of␈α∞a␈α
special␈α∞reserved␈α∞scalar␈α∞variable␈α
TIME,␈α∞which␈α∞is␈α∞changed␈α
every
␈↓ ↓H␈↓clock␈α⊃tick,␈α⊃thus␈α⊂invalidating␈α⊃any␈α⊃values␈α⊂calculated␈α⊃by␈α⊃expressions␈α⊂that␈α⊃depend␈α⊃on␈α⊃TIME␈α⊂(see
␈↓ ↓H␈↓Section 2.4 and Appendix III).  For instance we might have

␈↓ ↓H␈↓        DYNAMIC FRAME conveyor_belt;
␈↓ ↓H␈↓        VELOCITY SCALAR speed; {␈↓βspeed of the conveyor belt␈↓}
␈↓ ↓H␈↓        speed ←5*IN/SEC;

␈↓ ↓H␈↓        conveyor_belt <= FRAME(NILROT,speed*TIME*Y);

␈↓ ↓H␈↓␈↓ αh␈↓β{In␈α∀this␈α∀example,␈α∀we␈α∪won't␈α∀ever␈α∀use␈α∀the␈α∀"true"␈α∪location␈α∀of␈α∀the␈α∀belt.␈α∀ Rather,␈α∪we
␈↓ ↓H␈↓β␈↓ αhwill affix things to it, so that they are carried along by the belt.}

␈↓ ↓H␈↓        TIME SCALAR t0;
␈↓ ↓H␈↓        REQUIRE "PUMP.075" SOURCE_FILE;
␈↓ ↓H␈↓␈↓ αh␈↓β{This␈α∨defines,␈α∨among␈α∨other␈α∨things,␈α∨the␈α∨frames␈α∨pumpbase␈α∨and␈α≡pumpgrasp.
␈↓ ↓H␈↓β␈↓ αhInitially,␈α∪suppose␈α∪that␈α∪we␈α∪know␈α∪that␈α∩the␈α∪pumpbase␈α∪is␈α∪somewhere␈α∪on␈α∪the␈α∩conveyor.
␈↓ ↓H␈↓β␈↓ αhWe call a vision routine to find it.}

␈↓ ↓H␈↓        VISUALLY_LOCATE(pumpbase,t0);
␈↓ ↓H␈↓␈↓ αh␈↓β{Also,␈α∪set␈α∩t0␈α∪to␈α∪the␈α∩value␈α∪of␈α∪TIME␈α∩at␈α∪which␈α∩the␈α∪picture␈α∪was␈α∩taken␈α∪(ie␈α∪the␈α∩time
␈↓ ↓H␈↓β␈↓ αhthat the pumpbase was at the location set by the procedure).}

␈↓ ↓H␈↓        AFFIX pumpbase TO conveyor_belt
␈↓ ↓H␈↓                AT (pumpbase → FRAME(NILROT,speed*t0*Y));

␈↓ ↓H␈↓      {␈↓βOne effect of this is:
␈↓ ↓H␈↓β           ␈↓pumpbase(t) <= (pumpbase(t0)→conveyor_belt(t0))*conveyor_belt;
␈↓ ↓H␈↓        }

␈↓ ↓H␈↓        MOVE YELLOW TO pumpgrasp;

␈↓ ↓H␈↓␈↓ αh␈↓β{Presumably,␈α_pumpgrasp␈α→is␈α_attached␈α_rigidly␈α→to␈α_pumpbase.␈α_ Since␈α→pumpbase␈α_is
␈↓ ↓H␈↓β␈↓ αhattached␈α∨to␈α a␈α∨dynamic␈α thing␈α∨(conveyor_belt)␈α then␈α∨pumpgrasp␈α is␈α∨computed
␈↓ ↓H␈↓β␈↓ αhdynamically, too, so that the arm will track the grasp point.}

␈↓ ↓H␈↓        CENTER YELLOW;
␈↓ ↓H␈↓         {␈↓βgrasps the object␈↓}
␈↓ ↓H␈↓6.2␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α_DYNAMIC FRAMES ␈↓ 
aPage 99



␈↓ ↓H␈↓        UNFIX pumpbase FROM conveyor_belt;
␈↓ ↓H␈↓        AFFIX pumpbase TO YELLOW;
␈↓ ↓H␈↓        MOVE pumpbase TO jig_location_1; {␈↓βwherever ␈↓that␈↓β is␈↓}


␈↓ ↓H␈↓It␈αis␈αperhaps␈αworth␈αpointing␈αout␈αthat␈αthere␈αis␈αnothing␈αparticularly␈αmagical␈αabout␈αTIME;␈αa␈αsimilar
␈↓ ↓H␈↓technique␈α∀could␈α∀be␈α∀used,␈α∀say,␈α∀for␈α∀moving␈α∀to␈α∪some␈α∀frame␈α∀whose␈α∀value␈α∀is␈α∀a␈α∀function␈α∀of␈α∪a
␈↓ ↓H␈↓continuously varying A-to-D reading.





␈↓ ↓H␈↓␈↓∧6.3 EXTENSIONS TO OTHER ARMS AND DEVICES␈↓

␈↓ ↓H␈↓The␈α
initial␈α∞version␈α
of␈α∞the␈α
'AL␈α∞system␈α
will␈α∞be␈α
designed␈α∞to␈α
run␈α∞with␈α
two␈α∞Stanford␈α
Arms,␈α∞but␈α
the
␈↓ ↓H␈↓system␈α
is␈α
in␈α
no␈α
way␈α
limited␈αto␈α
any␈α
particular␈α
manipulators.␈α
 All␈α
manipulator-dependent␈αroutines
␈↓ ↓H␈↓are␈α
grouped␈α
together␈α
and␈α∞are␈α
written␈α
in␈α
SAIL;␈α
in␈α∞order␈α
to␈α
interface␈α
another␈α
manipulator␈α∞to␈α
the
␈↓ ↓H␈↓system␈αthese␈αroutines␈αwould␈αhave␈αto␈αbe␈αrewritten,␈αmost␈αnotably␈αthe␈αsolution␈αand␈αdynamics␈αmodels.
␈↓ ↓H␈↓In␈α∂the␈α∂case␈α∂of␈α∂non-manipulator␈α∂type␈α∞devices,␈α∂such␈α∂as␈α∂cranes,␈α∂the␈α∂trajectory␈α∂generating␈α∞routines
␈↓ ↓H␈↓would␈α∞also␈α
need␈α∞rewriting,␈α
but␈α∞as␈α∞we␈α
lack␈α∞any␈α
experience␈α∞in␈α∞this␈α
direction␈α∞we␈α
will␈α∞pursue␈α∞it␈α
no
␈↓ ↓H␈↓further at this time.

␈↓ ↓H␈↓Simple␈α
devices␈α∞such␈α
as␈α∞vices␈α
or␈α∞tools␈α
have␈α
their␈α∞own␈α
keyword␈α∞syntax␈α
and␈α∞are␈α
controlled␈α∞by␈α
the
␈↓ ↓H␈↓OPERATE statement. In this case new routines would need to be added.





␈↓ ↓H␈↓␈↓∧6.4 FINE CONTROL␈↓

␈↓ ↓H␈↓Interactive␈α
control␈α
of␈α
the␈α
arm␈αhas␈α
to␈α
date␈α
been␈α
limited;␈αwe␈α
can␈α
output␈α
joint␈α
torque␈α
and␈αmonitor
␈↓ ↓H␈↓joint␈α
position,␈α∞and␈α
have␈α
two␈α∞binary␈α
touch␈α∞sensors␈α
inside␈α
the␈α∞fingers.␈α
Force-sensing␈α∞elements␈α
are
␈↓ ↓H␈↓being␈α∞developed␈α∞for␈α∂the␈α∞hand␈α∞and␈α∞we␈α∂are␈α∞interested␈α∞in␈α∞more␈α∂powerful␈α∞touch␈α∞sensors;␈α∂when␈α∞we
␈↓ ↓H␈↓have␈αgained␈αexperience␈αwith␈αthese␈αdevices␈αwe␈αwill␈αextend␈αthe␈αlanguage␈αto␈αfacilitate␈αtheir␈αuse.␈αThe
␈↓ ↓H␈↓present␈αversion␈αof␈α
the␈αlanguage␈αreflects␈αthose␈α
things␈αwhich␈αwe␈αhave␈α
verified␈αin␈αpractice␈α
and␈αfeel
␈↓ ↓H␈↓will move development in the right direction.





␈↓ ↓H␈↓␈↓∧6.5 COLLISION AVOIDING␈↓

␈↓ ↓H␈↓Since␈α∂the␈α∂available␈α⊂collision␈α∂avoiders␈α∂are␈α∂quite␈α⊂slow,␈α∂the␈α∂initial␈α∂system␈α⊂relies␈α∂upon␈α∂the␈α⊂user␈α∂to
␈↓ ↓H␈↓provide␈αhis␈αown␈α
collision␈αavoiding␈αin␈αthe␈α
form␈αof␈αVIAs␈α
and␈αDEPROACHes.␈α When␈αfast␈α
collision
␈↓ ↓H␈↓avoiders become available they can be meaningfully included in the system.
␈↓ ↓H␈↓Page 100␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α	␈↓ H



␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α0␈↓∧CHAPTER 7␈↓
␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α1␈↓¬BIBLIOGRAPHY␈↓

␈↓ ↓H␈↓[Baumgart]␈α↔B.␈α↔Baumgart,␈α↔␈↓βGEOMED␈α↔-␈α⊗A␈α↔Geometric␈α↔Editor␈↓␈α↔Stanford␈α↔Artificial␈α⊗Intelligence
␈↓ ↓H␈↓␈↓ αHLaboratory Operating Note 68, May 1972.

␈↓ ↓H␈↓[Bejczy]␈α∂A.␈α∂K.␈α∂Bejczy,␈α∂␈↓βRobot␈α∂Arm␈α∂Dynamics␈α∂and␈α∂Control,␈↓␈α∂Jet␈α∂Propulsion␈α⊂Laboratory,␈α∂Technical
␈↓ ↓H␈↓␈↓ αHMemorandum 33-669, February, 1974.

␈↓ ↓H␈↓[Bobrow␈αand␈αRaphael]␈αDaniel␈αG.␈α
Bobrow␈αand␈αBertram␈αRaphael,␈α␈↓β␈αNew␈α
Programming␈αLanguages
␈↓ ↓H␈↓β␈↓ αHfor␈αAI␈αResearch␈↓␈αTutorial␈αLecture␈αpresented␈αat␈αthe␈αThird␈αInternational␈αJoint␈αConference
␈↓ ↓H␈↓␈↓ αHon Artificial Intelligence.  Stanford University, Stanford, California 94025

␈↓ ↓H␈↓[Bolles␈α∀and␈α∀Paul]␈α∀R.␈α∀C.␈α∀Bolles,␈α∀R.␈α∪Paul,␈α∀␈↓βThe␈α∀Use␈α∀of␈α∀Sensory␈α∀Feedback␈α∀in␈α∀a␈α∪Programmable
␈↓ ↓H␈↓β␈↓ αHAssembly System␈↓, Stanford Artificial Intelligence Project, Memo No. 220, October 1973.

␈↓ ↓H␈↓[DEC]␈α⊗Digital␈α⊗Equipment␈α⊗Corporation,␈α⊗␈↓βPDP␈α⊗11/45␈α⊗Processor␈α⊗Handbook,␈↓␈α⊗Digital␈α⊗Equipment
␈↓ ↓H␈↓␈↓ αHCorporation, 1974.

␈↓ ↓H␈↓[Ernst]␈α∀H.␈α∀A.␈α∀Ernst,␈α∀"MH-1,␈α∀A␈α∀Computer-Operated␈α∀Mechanical␈α∀Hand,"␈α∀1962␈α∀Spring␈α∪Joint
␈↓ ↓H␈↓␈↓ αHComputer Conference, San Francisco, May 1-3, AFIPS Proceedings, pp. 39-51.

␈↓ ↓H␈↓[Feldman 71a]␈α∞J.␈α∞A.␈α∞Feldman,␈α∞R.␈α∞F.␈α
Sproull,␈α∞␈↓βSystem␈α∞Support␈α∞for␈α∞the␈α∞Stanford␈α∞Hand-Eye␈α
System,␈↓
␈↓ ↓H␈↓␈↓ αHSecond␈α
International␈αJoint␈α
Conference␈α
on␈αArtificial␈α
Intelligence,␈α
London,␈αSeptember␈α
1-3,
␈↓ ↓H␈↓␈↓ αH1971.

␈↓ ↓H␈↓[Feldman 71b]␈α∞J.␈α∞Feldman,␈α∞K.␈α∞Pingle,␈α∞T.␈α∞Binford,␈α∞G.␈α
Falk,␈α∞A.␈α∞Kay,␈α∞R.␈α∞Paul,␈α∞R.␈α∞Sproull,␈α∞and␈α
J.
␈↓ ↓H␈↓␈↓ αHTennenbaum,␈α∀␈↓βThe␈α∀Use␈α∀of␈α∀Vision␈α∀and␈α∀Manipulation␈α∀to␈α∀Solve␈α∀the␈α∃`Instant␈α∀Insanity'
␈↓ ↓H␈↓β␈↓ αHPuzzle,␈↓␈α_Second␈α↔International␈α_Joint␈α_Conference␈α↔on␈α_Artificial␈α_Intelligence,␈α↔London,
␈↓ ↓H␈↓␈↓ αHSeptember 1-3, 1971.

␈↓ ↓H␈↓[Feldman 72]␈α∞J.␈α∂Feldman,␈α∞J.␈α∂Low,␈α∞R.␈α∂Taylor,␈α∞D.␈α∂Swinehart,␈α∞"Recent␈α∂Developments␈α∞in␈α∂SAIL,␈α∞an
␈↓ ↓H␈↓␈↓ αHAlgol␈α∀Based␈α∀Language␈α∀for␈α∀Artificial␈α∀Intelligence,"␈α∀Proceedings␈α∀of␈α∀the␈α∀FJCC,␈α∀1972
␈↓ ↓H␈↓␈↓ αHpp.1193-1202.

␈↓ ↓H␈↓[Gill]␈α→A.␈α→Gill,␈α→␈↓βVisual␈α→Feedback␈α→and␈α→Related␈α→Problems␈α→in␈α→Computer␈α→Controlled␈α_Hand-Eye
␈↓ ↓H␈↓β␈↓ αHCoordination,␈↓ Stanford Artificial Intelligence Project, Memo No. 178, October 1972.

␈↓ ↓H␈↓[Goto]␈α
T.␈α
Goto,␈α
␈↓βet␈α
al.␈↓,␈α
"Compact␈α∞Packaging␈α
by␈α
Robot␈α
With␈α
Tactile␈α
Sensors,"␈α
Proceedings␈α∞of␈α
the
␈↓ ↓H␈↓␈↓ αHSecond International Symposium on Industrial Robots, pp. 149-159, May 1972.

␈↓ ↓H␈↓[IITRI] ␈↓βProceedings of the 2nd. International Symposium on Industrial Robots␈↓, May 1972.

␈↓ ↓H␈↓[Inoue]␈α∪H.␈α∀Inoue,␈α∪"Computer␈α∀Controlled␈α∪Bilateral␈α∀Manipulator,"␈α∪Bulletin␈α∀of␈α∪the␈α∀JSME,␈α∪pp.
␈↓ ↓H␈↓␈↓ αH199-207, Vol. 14, No. 69, 1971.

␈↓ ↓H␈↓[Inoue]␈α∃H.␈α∃Inoue,␈α⊗"Force␈α∃Feedback␈α∃in␈α∃Precise␈α⊗Assembly␈α∃Tasks,"␈α∃Massachusetts␈α⊗Institute␈α∃of
␈↓ ↓H␈↓␈↓ αHTechnology A. I. Memo No. ***.
␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α
␈↓ 
RPage 101



␈↓ ↓H␈↓[Kahn]␈α∃M.␈α∀E.␈α∃Kahn,␈α∃␈↓βThe␈α∀Near-Minimum-Time␈α∃Control␈α∀of␈α∃Open-Loop␈α∃Articulated␈α∀Kinematic
␈↓ ↓H␈↓β␈↓ αHChains␈↓, Stanford Artificial Intelligence Project, Memo No. 106, December 1969.

␈↓ ↓H␈↓[Leslie]␈α_W.␈α_H.␈α_P.␈α_Leslie,␈α_ed.␈α_␈↓βNumerical␈α_Control␈α_Programming␈α_Languages␈↓,␈α↔North-Holland
␈↓ ↓H␈↓␈↓ αHPublishing Company, London, 1972.

␈↓ ↓H␈↓[Lindbom]␈α
T.␈α
H.␈α∞Lindbom,␈α
"Today's␈α
Robots␈α∞at␈α
Work␈α
in␈α
Industry:␈α∞Matching␈α
the␈α
Robot␈α∞and␈α
the
␈↓ ↓H␈↓␈↓ αHJob,"␈αProceedings␈αof␈αthe␈α2nd.␈αInternational␈αSymposium␈αon␈αIndustrial␈αRobots,␈αMay␈α1972,
␈↓ ↓H␈↓␈↓ αHpp.129-148

␈↓ ↓H␈↓[Nevins 73]␈α∩J.␈α∩L.␈α∩Nevins,␈α∩D.␈α∩E.␈α∩Whitney,␈α∩S.␈α∩N.␈α∩Simunovic,␈α∩␈↓βSystem␈α∩Architecture␈α∩for␈α∩Assembly
␈↓ ↓H␈↓β␈↓ αHMachines␈↓,␈α⊂The␈α⊂Charles␈α⊂Stark␈α⊃Draper␈α⊂Laboratory,␈α⊂Inc.,␈α⊂Memo␈α⊂No.␈α⊃R-764,␈α⊂November
␈↓ ↓H␈↓␈↓ αH1973.

␈↓ ↓H␈↓[Nevins 74]␈α∩J.␈α⊃L.␈α∩Nevins,␈α∩D.␈α⊃E.␈α∩Whitney,␈α⊃␈↓βet␈α∩al.␈↓,␈α∩␈↓βExploratory␈α⊃Research␈α∩in␈α∩Industrial␈α⊃Modular
␈↓ ↓H␈↓β␈↓ αHAssembly␈↓, The Charles Stark Draper Laboratory, Inc., Memo No. R-800, March 1974.

␈↓ ↓H␈↓[Nilsson]␈αN.␈αJ.␈αNilsson,␈αJ.␈αAgin,␈αB.␈αG.␈αDeutsch,␈αR.␈αFikes,␈αE.␈αD.␈αSacerdoti,␈αJ.␈αM.␈αTenenbaum,␈α
"Plan
␈↓ ↓H␈↓␈↓ αHfor␈αa␈αComputer-Based␈αConsultant␈αSystem,"␈αArtificial␈αIntelligence␈αCenter␈αTechnical␈α
Note
␈↓ ↓H␈↓␈↓ αH94, May 1974.

␈↓ ↓H␈↓[Paul]␈α∞R.␈α∂P.␈α∞Paul,␈α∞␈↓βModelling,Trajectory␈α∂Calculation␈α∞and␈α∞Servoing␈α∂of␈α∞a␈α∞Computer␈α∂Controlled␈α∞Arm␈↓,
␈↓ ↓H␈↓␈↓ αHStanford Artificial Intelligence Project, Memo No. 177, March 1973.

␈↓ ↓H␈↓[Pieper]␈α∃D.␈α⊗L.␈α∃Pieper,␈α⊗␈↓βThe␈α∃Kinematics␈α⊗of␈α∃Manipulators␈α⊗Under␈α∃Computer␈α⊗Control␈↓,␈α∃Stanford
␈↓ ↓H␈↓␈↓ αHArtificial Intelligence Project, Memo No. 72, October 1968.

␈↓ ↓H␈↓[Requicha]␈α⊃A.␈α⊂A.␈α⊃G.␈α⊂Requicha,␈α⊃N.␈α⊂M.␈α⊃Samuel,␈α⊂H.␈α⊃B.␈α⊂Voelker,␈α⊃␈↓βPart␈α⊂and␈α⊃Assembly␈α⊂Description
␈↓ ↓H␈↓β␈↓ αHLanguages␈α⊃--␈α∩II␈↓,␈α⊃TM-20,␈α∩Production␈α⊃Automation␈α⊃Project,␈α∩College␈α⊃of␈α∩Engineering␈α⊃&
␈↓ ↓H␈↓␈↓ αHApplied Science, The University of Rochester, August 1974.

␈↓ ↓H␈↓[Roberts 63]␈α⊂L.␈α⊃G.␈α⊂Roberts,␈α⊃␈↓βMachine␈α⊂Perception␈α⊂of␈α⊃Three-Dimensional␈α⊂Solids␈↓,␈α⊃Technical␈α⊂Report
␈↓ ↓H␈↓␈↓ αHNo. 315, Lincoln Laboratory, Massachusetts Institute of Technology, May 1963.

␈↓ ↓H␈↓[Roberts 65]␈α↔L.␈α⊗G.␈α↔Roberts,␈α↔␈↓βHomogeneous␈α⊗Matrix␈α↔Representation␈α⊗and␈α↔Manipulation␈α↔of␈α⊗N-
␈↓ ↓H␈↓β␈↓ αHDimensional␈αConstructs␈↓,␈αDocument␈αMS1045,␈αLincoln␈αLaboratory,␈αMassachusetts␈αInstitute
␈↓ ↓H␈↓␈↓ αHof Technology, May 1965.

␈↓ ↓H␈↓[Rosen]␈α∃C␈α∀Rosen,␈α∃␈↓βet.␈α∀al.,␈α∃Exploratory␈α∀Research␈α∃in␈α∀Advanced␈α∃Automation,␈↓␈α∃Stanford␈α∀Research
␈↓ ↓H␈↓␈↓ αHInstitute Report, December 1973.

␈↓ ↓H␈↓[Scheinman]␈α~V.␈α~D.␈α≠Scheinman,␈α~␈↓βDesign␈α~of␈α≠a␈α~Computer␈α~Manipulator␈↓,␈α≠Stanford␈α~Artificial
␈↓ ↓H␈↓␈↓ αHIntelligence Project, Memo No. 92, June 1969.

␈↓ ↓H␈↓[Sussman]␈α∂Gerald␈α∞Jay␈α∂Sussman,␈α∂␈↓βA␈α∞Computational␈α∂Model␈α∂of␈α∞Skill␈α∂Acquisition␈↓,␈α∂Ph.D.␈α∞dissertation,
␈↓ ↓H␈↓␈↓ αHArtificial␈α⊂Intelligence␈α⊂Laboratory,␈α⊂Massachusetts␈α⊂Institute␈α⊂of␈α⊃Technology.␈α⊂ Cambridge,
␈↓ ↓H␈↓␈↓ αHMassachusetts.  August, 1973.
␈↓ ↓H␈↓Page 102␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α	␈↓ H



␈↓ ↓H␈↓[Swinehart]␈αD.␈αSwinehart,␈α
R.␈αSproull,␈α␈↓βSail␈↓,␈αStanford␈α
Artificial␈αIntelligence␈αProject,␈α
Memo␈αNo. 57,
␈↓ ↓H␈↓␈↓ αHNovember 1969.

␈↓ ↓H␈↓[VanLehn]␈α
K␈α
VanLehn,␈α∞ed.␈α
 ␈↓βSail␈α
User's␈α
Manual␈↓,␈α∞Stanford␈α
Artificial␈α
Intelligence␈α∞Project,␈α
Memo
␈↓ ↓H␈↓␈↓ αHNo. 204, July 1973.

␈↓ ↓H␈↓[Whitney]␈α↔D.␈α↔E.␈α↔Whitney,␈α↔"Resolved␈α↔Motion␈α↔Rate␈α↔Control␈α↔of␈α↔Manipulators␈α↔and␈α⊗Human
␈↓ ↓H␈↓␈↓ αHProstheses,"␈αIEEE␈αTransaction␈αon␈αMan-Machine␈αSystems,␈αpp.␈α47-53,␈αVol␈αMMS-10,␈αNo.
␈↓ ↓H␈↓␈↓ αH2, June 1969.

␈↓ ↓H␈↓[Wickman]␈α∪W.␈α∪M.␈α∪Wickman,␈α∪␈↓βUse␈α∪of␈α∀Optical␈α∪Feedback␈α∪in␈α∪the␈α∪Computer␈α∪Control␈α∪of␈α∀an␈α∪Arm,␈↓
␈↓ ↓H␈↓␈↓ αHStanford Artificial Intelligence Project, Memo No. 56, August 1967.

␈↓ ↓H␈↓[Will]␈α∞Peter␈α∞M.␈α∞Will␈α∞and␈α∞David␈α∂D␈α∞Grossman␈α∞␈↓βAn␈α∞Experimental␈α∞System␈α∞for␈α∂Computer␈α∞Controlled
␈↓ ↓H␈↓β␈↓ αHMechanical␈α∂Assembly␈↓,␈α⊂IBM␈α∂Research␈α⊂Report␈α∂RC␈α∂4922,␈α⊂Yorktown␈α∂Heights,␈α⊂New␈α∂York.
␈↓ ↓H␈↓␈↓ αHJuly, 1974.
␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α
␈↓ 
RPage 103



␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α+␈↓∧APPENDIX I␈↓
␈↓ ↓H␈↓␈α?␈α?␈α?␈α_␈↓¬EXAMPLE DIALOG WITH THE 'AL SYSTEM␈↓

␈↓ ↓H␈↓Here␈αis␈αa␈αsample␈αconversation␈αa␈αuser␈α
might␈αhave␈αwith␈α'AL.␈αIt␈αdemonstrates␈αthe␈αfollowing␈α
features:
␈↓ ↓H␈↓Typing␈α∪in␈α∪source␈α∩code␈α∪by␈α∪hand,␈α∩requesting␈α∪source␈α∪code␈α∩to␈α∪be␈α∪read␈α∩from␈α∪a␈α∪file,␈α∩immediate
␈↓ ↓H␈↓execution␈α
of␈α
commands␈αby␈α
the␈α
arm,␈αreturn␈α
of␈α
values␈αfrom␈α
the␈α
arm,␈αloading␈α
compiled␈α
code␈αinto␈α
the
␈↓ ↓H␈↓runtime␈α⊂computer,␈α⊂and␈α⊂executing␈α⊂that␈α⊂code.␈α⊂ The␈α⊂supervisor␈α⊂prompts␈α⊂with␈α⊂the␈α⊂sign␈α⊂"⊃".␈α⊂ The
␈↓ ↓H␈↓material in the right-hand column is explanatory.

␈↓ ↓H␈↓ε⊃ COMPILE TTY                           | Request to read in from
␈↓ ↓H␈↓ε                                        |   console for compilation.
␈↓ ↓H␈↓ε⊂ type <alt> when done ⊃                | Message from supervisor
␈↓ ↓H␈↓εMOVE YELLOW                             | Simple move statement
␈↓ ↓H␈↓ε   TO FRAME(ROT(X,90),VECTOR(20,30,1)); |   Destination
␈↓ ↓H␈↓εFRAME PLACE1;                           | Declaration
␈↓ ↓H␈↓εPLACE1 ← YELLOW;                        | Assignment
␈↓ ↓H␈↓εPLACE2 ← PLACE1 + VECTOR(0,0,5);        | Assignment
␈↓ ↓H␈↓ε⊂ OK to declare PLACE2 a FRAME? ⊃  YES  | Parser error, with option.
␈↓ ↓H␈↓ε$                                       | End of file (altmode)
␈↓ ↓H␈↓ε⊂ no errors. compiled:  TTY(1) ⊃        | Compiler message.
␈↓ ↓H␈↓ε                                        |
␈↓ ↓H␈↓ε                                        | Now user wants to park arm.
␈↓ ↓H␈↓ε⊃ COMPILE TTY                           | Request to read in from
␈↓ ↓H␈↓ε                                        |   console for compilation
␈↓ ↓H␈↓ε⊂ type <alt> when done ⊃                | Message from supervisor
␈↓ ↓H␈↓εYELLOW ←← READ(YELLOW);                 | Get planning value of Yellow
␈↓ ↓H␈↓ε                                        |   arm correct
␈↓ ↓H␈↓εMOVE YELLOW TO YPARK  $                 | User wants to park the arm
␈↓ ↓H␈↓ε⊂ no errors. compiled:  TTY(2) ⊃        | Compiler message.
␈↓ ↓H␈↓ε⊃ EXECUTE TTY(2)                        | Request to execute park
␈↓ ↓H␈↓ε                                        |   code
␈↓ ↓H␈↓ε⊂ loading TTY(2) ⊃                      | First, loading to be done
␈↓ ↓H␈↓ε⊂ executing TTY(2) ⊃                    | Message as execution starts
␈↓ ↓H␈↓ε⊂ done ⊃                                | Message at end of execution
␈↓ ↓H␈↓ε                                        |
␈↓ ↓H␈↓ε                                        | Now user wants to try his new
␈↓ ↓H␈↓ε                                        |   code
␈↓ ↓H␈↓ε⊃ EXECUTE TTY(1)                        | Request to execute code
␈↓ ↓H␈↓ε⊂ loading TTY(1) ⊃                      | First, loading to be done
␈↓ ↓H␈↓ε⊂ executing TTY(1) ⊃                    | Message as execution starts
␈↓ ↓H␈↓ε⊂ done ⊃                                | Message at end of execution
␈↓ ↓H␈↓ε                                        |
␈↓ ↓H␈↓ε⊃ PLACE3 ←← READ(YELLOW)                | Ask to read hand position
␈↓ ↓H␈↓ε⊂ OK to declare PLACE3 a FRAME? ⊃  YES  | Use of undeclared variable
␈↓ ↓H␈↓ε⊃ WRITE(#(PLACE3))                      | Want planning value
␈↓ ↓H␈↓ε⊂ #(PLACE3) = FRAME(ROT(VECTOR(.3,.5,.82),17*DEG),
␈↓ ↓H␈↓ε                    VECTOR(19.9*CM, 30.1*CM, 1.1*CM)) ⊃
␈↓ ↓H␈↓ε                                        | Indication of what was set
␈↓ ↓H␈↓ε⊃ WRITE(PLACE4)                         | Want runtime value
␈↓ ↓H␈↓ε⊂ PLACE4 not declared ⊃                 | No runtime value!
␈↓ ↓H␈↓ε⊃ WRITE(#(V1))                          | Request for planning value
␈↓ ↓H␈↓ε⊂ #(V1) = VECTOR(3.0, 0, 20.13) ⊃       |
␈↓ ↓H␈↓ε⊃ V1 ←← VECTOR(4.0, 0, 20.13)           | User can change planning
␈↓ ↓H␈↓ε                                        |   values.
␈↓ ↓H␈↓ε⊃ V1 ← (4.0, 0, 20.13)                  | User can change real values.
␈↓ ↓H␈↓Page 104␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α	␈↓ H



␈↓ ↓H␈↓ε⊃ COMPILE HACK.AL[1,LOU]                | Ask for compile from file
␈↓ ↓H␈↓ε⊂ Error in line 310 of HACK.AL[1,LOU].  | Parser error message
␈↓ ↓H␈↓ε                        THEN            | Gives line with <lf>
␈↓ ↓H␈↓ε                             STUP       |   at point of error
␈↓ ↓H␈↓εOption ⊃ ?                              | User typed "?"
␈↓ ↓H␈↓εI:      Insert replacement text         | A list of options to user
␈↓ ↓H␈↓εZ:      Use line editor to fix          |
␈↓ ↓H␈↓εM:      Show more context               | This would give entire
␈↓ ↓H␈↓εF:      Flush to end of statement       |   statement
␈↓ ↓H␈↓εE:      Switch to E                     | E is a text editor
␈↓ ↓H␈↓εS:      Switch to SOS                   | SOS is a text editor
␈↓ ↓H␈↓εQ:      Quit. Abort compilation         |
␈↓ ↓H␈↓εOption ⊃ I                              | User chooses to insert
␈↓ ↓H␈↓ε                                        |   replacement
␈↓ ↓H␈↓ε⊂ type <alt> when done ⊃                | Message from supervisor
␈↓ ↓H␈↓ε                        THEN STOP       |  "STUP" changed to "STOP"
␈↓ ↓H␈↓ε$                                       | End of insertion
␈↓ ↓H␈↓ε⊂ error in line 520 of HACK.AL[1,LOU].  | trajectory calculator error
␈↓ ↓H␈↓ε                                        |   message
␈↓ ↓H␈↓ε        MOVE YELLOW                     | Only first line of
␈↓ ↓H␈↓ε                                        |   statement given
␈↓ ↓H␈↓εThe desired motion goes out of bounds in joint 3
␈↓ ↓H␈↓εin the first segment of motion.         |
␈↓ ↓H␈↓ε                                        | A bad motion
␈↓ ↓H␈↓εOption ⊃ E                              | User wants to edit with E.
␈↓ ↓H␈↓ε⊂ Switching to E.  To return, <CTR>XRU<CR> ⊃
␈↓ ↓H␈↓ε                                        | Universe is saved for retry
␈↓ ↓H␈↓ε⊂ Welcome back to 'AL.                  | Editing done
␈↓ ↓H␈↓εCompilation of HACK.AL[1,LOU] aborted ⊃ | After an edit, compilation
␈↓ ↓H␈↓ε                                        |   aborts.
␈↓ ↓H␈↓ε⊃ COMPILE HACK.AL[1,LOU]                | Request for recompilation
␈↓ ↓H␈↓ε⊂ No errors. Compiled: HACK.AL[1,LOU] ⊃ |
␈↓ ↓H␈↓ε                                        | Compilation succeeds.
␈↓ ↓H␈↓ε⊃ LOAD TTY(1),HACK.AL[1,LOU]            | Request to load into servo
␈↓ ↓H␈↓ε⊂ Loaded:  TTY(1), HACK.AL[1,LOU] ⊃     |
␈↓ ↓H␈↓ε⊃ STATUS                                | User wants to know where
␈↓ ↓H␈↓ε                                        |   he is
␈↓ ↓H␈↓εCompiled: TTY(1), TTY(2), HACK.AL[1,LOU]| Compilation status
␈↓ ↓H␈↓εLoaded: TTY(1), HACK.AL[1,LOU]          | Runtime status
␈↓ ↓H␈↓ε⊃ EXECUTE                               | Request for execution
␈↓ ↓H␈↓ε⊂ Executing TTY(1), HACK.AL[1,LOU] ⊃    |
␈↓ ↓H␈↓ε⊃ STATUS                                | User wants to know where
␈↓ ↓H␈↓ε                                        |   she is
␈↓ ↓H␈↓εInterpreter at line 320 in HACK.AL[1,LOU]
␈↓ ↓H␈↓ε                                        | Runtime status
␈↓ ↓H␈↓ε⊂ Interrupted by red button⊃            | Runtime error message. User
␈↓ ↓H␈↓ε                                        |   interrupted motion.
␈↓ ↓H␈↓εInterpreter at line 180 of HACK.AL[1,LOU]
␈↓ ↓H␈↓ε                                        | Servo status
␈↓ ↓H␈↓ε⊃ PROCEED                               | Request to continue motion
␈↓ ↓H␈↓ε⊂ Joint 4 has excessive force.          | Runtime error message.
␈↓ ↓H␈↓εInterpreter at line 150 of HACK.AL[1,LOU]
␈↓ ↓H␈↓ε                                        | Servo status
␈↓ ↓H␈↓ε⊃ DELETE HACK.AL                        | Request to delete last
␈↓ ↓H␈↓ε                                        |   compilation
␈↓ ↓H␈↓ε⊂ Deleting HACK.AL from runtime         | Removed from runtime
␈↓ ↓H␈↓ε⊂ Deleting HACK.AL from COMPILATION     | Removed from world of
␈↓ ↓H␈↓ε                                        |   compiler
␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α
␈↓ 
RPage 105



␈↓ ↓H␈↓ε⊃ E                                     | Switch to E.
␈↓ ↓H␈↓ε⊂ Switching to E.  To return, <CTR>XRU<CR>⊃
␈↓ ↓H␈↓ε⊂ Welcome back to 'AL⊃                  |
␈↓ ↓H␈↓ε⊃ COMPILE HACK.AL[1,LOU]                | Request for compilation
␈↓ ↓H␈↓ε⊂ No errors. Compiled: HACK.AL[1,LOU] ⊃ | Compilation succeeds
␈↓ ↓H␈↓ε⊃ SAVE WORLD IN W1                      | User wants world saved in
␈↓ ↓H␈↓ε⊂ World saved in W1.WLD ⊃               |   named location.
␈↓ ↓H␈↓ε⊃ RESTORE WORLD FROM W0                 | Request to restore previous
␈↓ ↓H␈↓ε                                        |   world
␈↓ ↓H␈↓ε⊂ W0.WLD not found ⊃                    | Expander error message
␈↓ ↓H␈↓ε⊃ RESTORE WORLD FROM W00                | Request to restore previous
␈↓ ↓H␈↓ε                                        |   world
␈↓ ↓H␈↓ε⊂ done                                  |
␈↓ ↓H␈↓ε⊃ BYE                                   | Request to leave the room
␈↓ ↓H␈↓ε⊂ Final status:                         | A final status rundown
␈↓ ↓H␈↓εLoad modules ready:  TTY(1).HLD, TTY(2).HLD, HACK.HLD
␈↓ ↓H␈↓εGoodbye ⊃
␈↓ ↓H␈↓εEXIT
␈↓ ↓H␈↓ε.␈↓
␈↓ ↓H␈↓Page 106␈α?␈α?␈α?␈α?␈α?␈α?␈α_BOLTING A BRACKET␈↓ H



␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α$␈↓∧APPENDIX II␈↓
␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α8␈↓¬PROGRAMMING EXAMPLES␈↓





␈↓ ↓H␈↓␈↓∧II.1 BOLTING A BRACKET ONTO A BEAM␈↓

␈↓ ↓H␈↓This␈αis␈αintended␈α
to␈αbe␈αa␈α
series␈αof␈αprogressively␈αmore␈α
complex␈αexamples␈αwhich␈α
demonstrate␈αsome
␈↓ ↓H␈↓of␈αthe␈αfeatures␈αin␈α
'AL,␈αincluding␈αaffixment,␈αcontrol␈α
structures,␈αmacros,␈αand␈αlibrary␈α
routines.␈α The
␈↓ ↓H␈↓first␈αset␈αof␈αthe␈αexamples␈αhave␈αessentially␈αthe␈αsame␈αgoal:␈αbolt␈αa␈αbracket␈αto␈αa␈αbeam.␈α Each␈αexample
␈↓ ↓H␈↓takes into account more possibilities or contains a different way of expressing the same thing.

␈↓ ↓H␈↓The initial affixment structure is:

␈↓ ↓H␈↓                STATION
␈↓ ↓H␈↓                    YELLOW
␈↓ ↓H␈↓                    BLUE
␈↓ ↓H␈↓                 BRACKET
␈↓ ↓H␈↓                    BRACKET_HOLE
␈↓ ↓H␈↓                    BRACKET_GRASP
␈↓ ↓H␈↓                 BOLT
␈↓ ↓H␈↓                 BEAM
␈↓ ↓H␈↓                    BEAM_HOLE

␈↓ ↓H␈↓The final affixment structure is:

␈↓ ↓H␈↓                STATION
␈↓ ↓H␈↓                    YELLOW
␈↓ ↓H␈↓                    BLUE
␈↓ ↓H␈↓                BEAM
␈↓ ↓H␈↓                    BEAM_HOLE
␈↓ ↓H␈↓                    BRACKET
␈↓ ↓H␈↓                        BRACKET_HOLE
␈↓ ↓H␈↓                        BRACKET_GRASP
␈↓ ↓H␈↓                    BOLT


␈↓ ↓H␈↓The initial structure can be created by the following declarations and assignments.  See Figure 2.1.


␈↓ ↓H␈↓FRAME beam, beam_hole;
␈↓ ↓H␈↓FRAME bracket, bracket_hole, bracket_grasp;
␈↓ ↓H␈↓FRAME bolt;

␈↓ ↓H␈↓beam ← FRAME(ROT(Z, 90*DEG), VECTOR(30, 24.2, 0));
␈↓ ↓H␈↓␈↓ αλ␈↓β{Beam␈α⊂is␈α⊂not␈α⊂affixed␈α⊃to␈α⊂anything␈α⊂initially.␈α⊂ Thus␈α⊃its␈α⊂default␈α⊂DEPROACH␈α⊂is␈α⊃the␈α⊂station's
␈↓ ↓H␈↓β␈↓ αλDEPROACH which is: TRANS(NILROT, 10*CM*Z)}
␈↓ ↓H␈↓II.1␈α?␈α?␈α?␈α?␈α?␈α?␈α8BOLTING A BRACKET␈↓ 
RPage 107



␈↓ ↓H␈↓beam_hole ← beam * FRAME(ROT(X, -90*DEG),  VECTOR(5.1, 0, 15));
␈↓ ↓H␈↓␈↓ αλ␈↓β{FRAME(ROT(X,␈α∀-90*DEG),␈α∪VECTOR(5.1,␈α∀0,␈α∪15))␈α∀is␈α∪the␈α∀relative␈α∪transform␈α∀from␈α∪beam
␈↓ ↓H␈↓β␈↓ αλto␈α∃the␈α∃beam_hole.␈α∃ Another␈α∃way␈α∃of␈α∃looking␈α∀at␈α∃this␈α∃is␈α∃that␈α∃within␈α∃the␈α∃beam's␈α∃frame␈α∀of
␈↓ ↓H␈↓β␈↓ αλreference,␈α↔the␈α↔beam_hole␈α⊗is␈α↔at␈α↔FRAME(ROT(X,␈α⊗-90*DEG),␈α↔VECTOR(5.1,␈α↔0,␈α↔15))␈α⊗The
␈↓ ↓H␈↓β␈↓ αλpremultiplication␈α≠by␈α≠beam␈α~transforms␈α≠this␈α≠relative␈α~location␈α≠out␈α≠to␈α≠the␈α~corresponding
␈↓ ↓H␈↓β␈↓ αλposition (in station coordinates) with respect to the current location of beam.}


␈↓ ↓H␈↓AFFIX beam_hole TO beam;
␈↓ ↓H␈↓ASSERT FORM(DEPROACH, beam_hole, TRANS(NILROT, VECTOR(0, 0, -3));
␈↓ ↓H␈↓␈↓ αλ␈↓β{this␈α⊗sets␈α⊗up␈α⊗a␈α⊗DEPROACH␈α⊗of␈α⊗-3␈α∃centimeters␈α⊗in␈α⊗the␈α⊗Z␈α⊗direction␈α⊗of␈α⊗the␈α∃beam_hole's
␈↓ ↓H␈↓β␈↓ αλcoordinate system.}

␈↓ ↓H␈↓bracket ← FRAME(ROT(Z,90*DEG),  VECTOR(20, 40, 0));
␈↓ ↓H␈↓bracket_hole ← bracket * FRAME(ROT(X, 180*DEG),  VECTOR(5.1, 2, 0));
␈↓ ↓H␈↓AFFIX bracket_hole TO bracket;
␈↓ ↓H␈↓bracket_grasp ← bracket * FRAME(ROT(X, 180*DEG), VECTOR(0, 1.5, 5));

␈↓ ↓H␈↓AFFIX bracket_grasp TO bracket RIGIDLY;
␈↓ ↓H␈↓␈↓ αλ␈↓β{Notice␈α⊃that␈α⊃changing␈α⊃bracket_grasp␈α⊃will␈α⊃automatically␈α⊃change␈α⊃bracket,␈α⊃which␈α⊃in␈α∩turn␈α⊃will
␈↓ ↓H␈↓β␈↓ αλautomatically␈α⊃change␈α⊃bracket_hole.␈α⊃ This␈α⊃is␈α⊃very␈α⊂handy␈α⊃if␈α⊃the␈α⊃position␈α⊃of␈α⊃the␈α⊃whole␈α⊂`object'
␈↓ ↓H␈↓β␈↓ αλis being updated by one grasping position (ie. bracket_grasp.}
␈↓ ↓H␈↓bolt ← FRAME(ROT(Z,90*DEG)*ROT(X,180*DEG), VECTOR(30, 60, 5));
␈↓ ↓H␈↓␈↓ αλ␈↓β{The bolt is assumed to be sticking out of a dispenser.}
␈↓ ↓H␈↓Page 108␈α?␈α?␈α?␈α?␈α?␈α?␈α_BOLTING A BRACKET␈↓ ≥II.1


















































␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈αβFigure  2.1
␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α2Initial World
␈↓ ↓H␈↓II.1␈α?␈α?␈α?␈α?␈α?␈α?␈α8BOLTING A BRACKET␈↓ 
RPage 109



␈↓ ↓H␈↓␈↓βII.1.1     EXAMPLE ONE␈↓

␈↓ ↓H␈↓The task involves the following steps:
␈↓ ↓H␈↓␈↓ αH(1)␈α
Pick␈α
up␈α
the␈α
bracket␈α
with␈α
the␈α
YELLOW␈αarm␈α
and␈α
position␈α
it␈α
next␈α
to␈α
the␈α
beam␈αso␈α
that
␈↓ ↓H␈↓␈↓ βλthe holes line up.
␈↓ ↓H␈↓␈↓ αH(2)␈αPick␈αup␈αthe␈αbolt␈αwith␈αthe␈αBLUE␈αarm␈αand␈αinsert␈αit␈αin␈αthe␈αhole␈α(in␈αthis␈αexample␈αit␈αis
␈↓ ↓H␈↓␈↓ βλnot screwed in; a later example will use a socket driver to tighten the bolt).
␈↓ ↓H␈↓␈↓ αH(3) Return both arms to park.


␈↓ ↓H␈↓The␈α
bracket␈αis␈α
assumed␈αto␈α
be␈α1␈α
cm␈αthick␈α
,␈α
and␈αthe␈α
bolt␈α4␈α
cm␈αlong.␈α
 The␈αfollowing␈α
program␈α
is␈αa
␈↓ ↓H␈↓straightforward␈α∀way␈α∀to␈α∀express␈α∃the␈α∀motions␈α∀and␈α∀feedback␈α∃necessary␈α∀to␈α∀carry␈α∀out␈α∃the␈α∀task.
␈↓ ↓H␈↓Everything␈α∞is␈α∂assumed␈α∞to␈α∂be␈α∞in␈α∂the␈α∞right␈α∞place␈α∂and␈α∞every␈α∂motion␈α∞is␈α∂assumed␈α∞to␈α∂accomplish␈α∞its
␈↓ ↓H␈↓desired␈α
effect.␈α
 For␈α
example,␈α
this␈α
program␈α
assumes␈α
that␈α
the␈α
arm␈α
is␈α
accurate␈α
enough␈α
to␈α∞align␈α
the
␈↓ ↓H␈↓bracket_hole␈αwith␈αthe␈αbeam_hole␈αand␈αto␈αinsert␈αthe␈αbolt␈αwithout␈αhitting␈αthe␈αside␈αor␈αbinding.␈α
 Later
␈↓ ↓H␈↓examples will take this type of error into account.

␈↓ ↓H␈↓DEFINE OZ = "72.007789*DYNES";
␈↓ ↓H␈↓␈↓ αλ␈↓β{This macro defines a unit of force OZ equal to 1/16 poundal}

␈↓ ↓H␈↓OPERATE YFINGERS WITH OPENING=3*CM;
␈↓ ↓H␈↓MOVE YELLOW TO bracket_grasp;
␈↓ ↓H␈↓␈↓ αλ␈↓β{Since␈α→bracket_grasp␈α→does␈α→not␈α→have␈α_a␈α→DEPROACH␈α→explicitly␈α→associated␈α→with␈α→it,␈α_the
␈↓ ↓H␈↓β␈↓ αλcompiler␈α∩checks␈α∩to␈α∩see␈α⊃if␈α∩it␈α∩is␈α∩affixed␈α⊃to␈α∩anything.␈α∩ It␈α∩is:␈α⊃bracket.␈α∩ But␈α∩bracket␈α∩does␈α⊃not
␈↓ ↓H␈↓β␈↓ αλhave␈α⊂a␈α⊂DEPROACH␈α⊂associated␈α⊂with␈α⊂it␈α⊂either.␈α⊂ Is␈α⊂it␈α⊂affixed␈α⊂to␈α⊂anything?␈α⊂ No.␈α⊂ Therefore,
␈↓ ↓H␈↓β␈↓ αλby␈α?␈α↓default␈α?the␈α?␈α↓compiler␈α?uses␈α?␈α↓the␈α?STATION's␈α?␈α↓DEPROACH␈α?(ie.
␈↓ ↓H␈↓β␈↓ αλTRANS(NILROT,10*CM*Z)) as the approach for bracket_grasp.}

␈↓ ↓H␈↓CENTER YELLOW;
␈↓ ↓H␈↓␈↓ αλ␈↓β{This closes the fingers until they grab something.}
␈↓ ↓H␈↓bracket_grasp ← YELLOW;
␈↓ ↓H␈↓␈↓ αλ␈↓β{Since␈α∪bracket_grasp␈α∩is␈α∪RIGIDLY␈α∩affixed␈α∪to␈α∩bracket,␈α∪this␈α∩statement␈α∪updates␈α∪bracket␈α∩and
␈↓ ↓H␈↓β␈↓ αλhence␈α↔anything␈α↔affixed␈α↔to␈α↔bracket␈α_(eg.␈α↔bracket_hole).␈α↔ In␈α↔effect,␈α↔the␈α_assumption␈α↔being
␈↓ ↓H␈↓β␈↓ αλmade␈α⊃is␈α⊃that␈α⊂the␈α⊃position␈α⊃of␈α⊂the␈α⊃whole␈α⊃`object'␈α⊂(ie.␈α⊃the␈α⊃bracket)␈α⊂can␈α⊃be␈α⊃updated␈α⊃by␈α⊂locating
␈↓ ↓H␈↓β␈↓ αλbracket_grasp.␈α≥ In␈α≥the␈α≤usage␈α≥above␈α≥the␈α≤arm␈α≥moves␈α≥to␈α≤the␈α≥planning␈α≥position␈α≤for
␈↓ ↓H␈↓β␈↓ αλbracket_grasp␈α⊂and␈α⊃then␈α⊂centers␈α⊃itself␈α⊂about␈α⊃the␈α⊂object␈α⊃between␈α⊂its␈α⊃fingers.␈α⊂ Notice␈α⊃that␈α⊂the
␈↓ ↓H␈↓β␈↓ αλfinal␈α≡position␈α≡of␈α≡the␈α≡arm␈α≡may␈α≡very␈α≡well␈α≡not␈α≡be␈α≡bracket_grasp␈α≡(because␈α≡of␈α≡the
␈↓ ↓H␈↓β␈↓ αλaccommodation␈α∀during␈α∀the␈α∀centering).␈α∪ Therefore,␈α∀the␈α∀bracket␈α∀might␈α∪not␈α∀be␈α∀where␈α∀it␈α∪was
␈↓ ↓H␈↓β␈↓ αλplanned␈α⊂to␈α⊂be.␈α⊃ This␈α⊂discrepancy␈α⊂between␈α⊃the␈α⊂planned␈α⊂world␈α⊂and␈α⊃the␈α⊂`actual'␈α⊂world␈α⊃has␈α⊂to
␈↓ ↓H␈↓β␈↓ αλbe␈α⊃reconciled.␈α⊃ The␈α⊃simplest␈α⊃assumption␈α⊃(and␈α⊃the␈α⊃assumption␈α⊃being␈α⊃used␈α⊃here)␈α⊃is␈α⊃that␈α⊃the
␈↓ ↓H␈↓β␈↓ αλonly␈α⊂difference␈α⊂between␈α⊂the␈α⊃planned␈α⊂location␈α⊂and␈α⊂the␈α⊂actual␈α⊃is␈α⊂that␈α⊂the␈α⊂`whole'␈α⊃bracket␈α⊂has
␈↓ ↓H␈↓β␈↓ αλbeen␈α∀moved␈α∀along␈α∀the␈α∀line␈α∀between␈α∃the␈α∀fingers␈α∀so␈α∀that␈α∀bracket_grasp␈α∀is␈α∀where␈α∃the␈α∀arm
␈↓ ↓H␈↓β␈↓ αλfound␈α∩it.␈α∩ More␈α∩complicated␈α∩updating␈α∩could␈α⊃be␈α∩done␈α∩by␈α∩visually␈α∩locating␈α∩the␈α∩bracket␈α⊃and
␈↓ ↓H␈↓β␈↓ αλreseting␈α↔bracket␈α⊗or␈α↔by␈α⊗feeling␈α↔the␈α⊗bracket␈α↔two␈α⊗or␈α↔three␈α⊗times,␈α↔combining␈α↔the␈α⊗resulting
␈↓ ↓H␈↓β␈↓ αλlocations␈α∀into␈α∪a␈α∀new␈α∀estimate␈α∪of␈α∀bracket's␈α∪location,␈α∀and␈α∀reseting␈α∪bracket.␈α∀ Notice␈α∀that␈α∪if
␈↓ ↓H␈↓β␈↓ αλthe␈α∃CENTER␈α⊗moved␈α∃the␈α⊗arm␈α∃away␈α⊗from␈α∃the␈α⊗planned␈α∃location␈α⊗and␈α∃no␈α⊗updating␈α∃were
␈↓ ↓H␈↓β␈↓ αλdone,␈α⊂the␈α⊃AFFIX␈α⊂statement␈α⊂which␈α⊃follows␈α⊂would␈α⊂affix␈α⊃the␈α⊂bracket␈α⊂to␈α⊃the␈α⊂YELLOW␈α⊃arm␈α⊂in
␈↓ ↓H␈↓β␈↓ αλsuch␈α⊃a␈α⊃way␈α⊃that␈α⊃the␈α⊃bracket␈α⊃was␈α⊃assumed␈α⊃to␈α⊃be␈α⊃at␈α⊃its␈α⊃planning␈α⊃position␈α⊃(which␈α⊃would␈α⊃be
␈↓ ↓H␈↓β␈↓ αλwrong).  The subsequent move to the beam_hole would also be off by the same amount.}
␈↓ ↓H␈↓Page 110␈α?␈α?␈α?␈α?␈α?␈α?␈α_BOLTING A BRACKET␈↓ λII.1.1



␈↓ ↓H␈↓AFFIX bracket TO YELLOW;
␈↓ ↓H␈↓MOVE bracket_hole TO beam_hole;
␈↓ ↓H␈↓␈↓ αλ␈↓β{Notice␈α∪that␈α∪the␈α∪bracket␈α∀approaches␈α∪the␈α∪beam␈α∪from␈α∪the␈α∀side␈α∪(not␈α∪from␈α∪above)␈α∀because␈α∪of
␈↓ ↓H␈↓β␈↓ αλthe␈α∀DEPROACH␈α∀set␈α∀up␈α∪for␈α∀beam_hole.␈α∀ In␈α∀this␈α∀example␈α∪the␈α∀bracket␈α∀is␈α∀assumed␈α∀to␈α∪go
␈↓ ↓H␈↓β␈↓ αλright␈α⊗next␈α⊗to␈α⊗the␈α⊗beam.␈α⊗ This␈α⊗MOVE␈α⊗is␈α⊗a␈α⊗move␈α⊗for␈α⊗the␈α⊗YELLOW␈α⊗arm␈α⊗(because␈α⊗the
␈↓ ↓H␈↓β␈↓ αλbracket␈α∀is␈α∀AFFIXed␈α∪to␈α∀it).␈α∀ From␈α∪the␈α∀definition␈α∀of␈α∪affixment␈α∀this␈α∀means␈α∀that␈α∪anything
␈↓ ↓H␈↓β␈↓ αλaffixed␈α∃to␈α⊗the␈α∃YELLOW␈α∃arm␈α⊗is␈α∃automatically␈α∃moved.␈α⊗ Thus,␈α∃bracket,␈α⊗bracket_hole,␈α∃and
␈↓ ↓H␈↓β␈↓ αλbracket_grasp␈α↔are␈α↔all␈α↔updated.␈α↔ The␈α↔fact␈α⊗that␈α↔the␈α↔move␈α↔was␈α↔specified␈α↔by␈α⊗mentioning
␈↓ ↓H␈↓β␈↓ αλbracket_hole␈α_(and␈α↔not␈α_YELLOW)␈α↔does␈α_not␈α↔change␈α_the␈α↔automatic␈α_updating␈α_within␈α↔the
␈↓ ↓H␈↓β␈↓ αλgraph structure.  Notice, in particular, that this is quite different from:
␈↓ ↓H␈↓β␈↓ αλ                AFFIX bracket TO YELLOW
␈↓ ↓H␈↓β␈↓ αλ                bracket_hole ← beam_hole
␈↓ ↓H␈↓β␈↓ αλwhich␈α∀would␈α∃change␈α∀the␈α∃value␈α∀of␈α∀bracket_hole␈α∃and␈α∀the␈α∃relative␈α∀position␈α∃between␈α∀bracket
␈↓ ↓H␈↓β␈↓ αλand bracket_hole, but leave YELLOW and bracket unchanged.}

␈↓ ↓H␈↓OPERATE BFINGERS WITH OPENING=3*CM;
␈↓ ↓H␈↓MOVE BLUE TO bolt;
␈↓ ↓H␈↓␈↓ αλ␈↓β{The station's APPROACH is used since the bolt is not affixed to anything.}

␈↓ ↓H␈↓CENTER BLUE;
␈↓ ↓H␈↓bolt ← BLUE;
␈↓ ↓H␈↓␈↓ αλ␈↓β{This insures that the latest value of bolt is used in the AFFIX command below.}

␈↓ ↓H␈↓AFFIX bolt TO BLUE;
␈↓ ↓H␈↓MOVE bolt TO beam_hole + VECTOR(0, 0, -5.3) WRT beam_hole;
␈↓ ↓H␈↓␈↓ αλ␈↓β{This␈α∃should␈α∃position␈α∃the␈α∃bolt␈α∃.3␈α∀centimeters␈α∃from␈α∃the␈α∃bracket.␈α∃ That␈α∃is,␈α∃the␈α∀YELLOW
␈↓ ↓H␈↓β␈↓ αλarm␈α∃is␈α∃now␈α∃holding␈α∃the␈α∃bracket␈α∃right␈α∃next␈α∃to␈α∃the␈α∃beam␈α∃(with␈α∃the␈α∃bracket_hole␈α∀aligned
␈↓ ↓H␈↓β␈↓ αλwith␈α⊂the␈α⊂beam_hole)␈α⊂and␈α⊂the␈α⊂BLUE␈α⊂arm␈α⊂is␈α⊂holding␈α⊂the␈α⊂bolt␈α⊂5.3␈α⊂centimeters␈α⊂away␈α⊃from␈α⊂the
␈↓ ↓H␈↓β␈↓ αλbracket_hole␈α∪(which␈α∪is␈α∪equivalent␈α∪to␈α∪beam_hole).␈α∀ But␈α∪remember␈α∪that␈α∪the␈α∪bracket␈α∪is␈α∀1␈α∪cm
␈↓ ↓H␈↓β␈↓ αλthick␈α⊂and␈α⊂the␈α⊂bolt␈α⊂is␈α⊂4␈α⊂cm␈α⊂long,␈α⊂thus␈α⊂the␈α⊂tip␈α⊂of␈α⊂the␈α⊂bolt␈α⊂is␈α⊂1.3␈α⊂cm␈α⊂from␈α⊂the␈α⊂beam_hole␈α⊂(or
␈↓ ↓H␈↓β␈↓ αλ.3 off of the bracket).}

␈↓ ↓H␈↓MOVE BLUE TO ⊗ + VECTOR(0, 0, 5) WRT beam_hole;
␈↓ ↓H␈↓    WITH FORCE = 0 ALONG X,Y OF BLUE
␈↓ ↓H␈↓    ON FORCE(Z WRT BLUE) > 60*OZ DO STOP BLUE;
␈↓ ↓H␈↓␈↓ αλ␈↓β{The␈α→arm␈α~stops␈α→when␈α~the␈α→bolt␈α~hits␈α→the␈α→bottom␈α~of␈α→the␈α~hole.␈α→ No␈α~DEPARTURE␈α→or
␈↓ ↓H␈↓β␈↓ αλAPPROACH is used because the destination involves the "⊗" construct.}

␈↓ ↓H␈↓OPERATE YFINGERS WITH OPENING = 3*CM;
␈↓ ↓H␈↓UNFIX bracket FROM YELLOW;
␈↓ ↓H␈↓AFFIX bracket TO beam;
␈↓ ↓H␈↓MOVE YELLOW TO YPARK;

␈↓ ↓H␈↓OPERATE BFINGERS WITH OPENING = 3*CM;
␈↓ ↓H␈↓UNFIX bolt FROM BLUE;
␈↓ ↓H␈↓AFFIX bolt TO beam;
␈↓ ↓H␈↓MOVE BLUE TO BPARK;

␈↓ ↓H␈↓WRITE("Finished");
␈↓ ↓H␈↓II.1.1␈α?␈α?␈α?␈α?␈α?␈α?␈α(BOLTING A BRACKET␈↓ 
RPage 111



␈↓ ↓H␈↓END;



␈↓ ↓H␈↓␈↓βII.1.2     EXAMPLE TWO␈↓


␈↓ ↓H␈↓This␈α⊂version␈α⊂adds␈α⊂a␈α⊂number␈α⊂of␈α∂checks␈α⊂(and␈α⊂some␈α⊂automatic␈α⊂recoveries)␈α⊂for␈α⊂possible␈α∂run-time
␈↓ ↓H␈↓errors␈α⊂such␈α⊂as␈α⊂not␈α⊂inserting␈α⊂the␈α⊂bolt.␈α∂ It␈α⊂also␈α⊂utilizes␈α⊂the␈α⊂COBEGIN␈α⊂-␈α⊂COEND␈α⊂capability␈α∂to
␈↓ ↓H␈↓describe␈αsimultaneous␈α(unordered,␈αindependent)␈αactions.␈α Thus,␈αthe␈αYellow␈αarm␈αcan␈αbe␈αpicking␈αup
␈↓ ↓H␈↓the␈αbracket␈αand␈α
positioning␈αit␈αnear␈α
the␈αbeam␈αwhile␈αthe␈α
Blue␈αarm␈αis␈α
picking␈αup␈αthe␈αbolt.␈α
 Collision
␈↓ ↓H␈↓avoidance is currently the responsibility of the user.

␈↓ ↓H␈↓DEFINE OZ="((72.007789*GM*CM)/(SEC*SEC))";

␈↓ ↓H␈↓positioning: COBEGIN
␈↓ ↓H␈↓    ypickup: BEGIN {␈↓βpick up bracket by YELLOW␈↓}
␈↓ ↓H␈↓    OPERATE YFINGERS WITH OPENING=3*CM;
␈↓ ↓H␈↓    MOVE YELLOW TO bracket_grasp;
␈↓ ↓H␈↓    CENTER YELLOW
␈↓ ↓H␈↓        ON OPENING = 0*CM DO
␈↓ ↓H␈↓            missed: BEGIN {␈↓βmissed bracket␈↓}
␈↓ ↓H␈↓            STOP YELLOW;
␈↓ ↓H␈↓            SCALAR flag;
␈↓ ↓H␈↓            OPERATE YFINGERS WITH OPENING=3*CM;
␈↓ ↓H␈↓            MOVE YELLOW
␈↓ ↓H␈↓                TO bracket_grasp * DEPROACH(bracket_grasp) DIRECTLY;
␈↓ ↓H␈↓␈↓ β(␈↓β{This␈α∩should␈α∪safely␈α∩move␈α∩the␈α∪arm␈α∩away␈α∪so␈α∩the␈α∩operator␈α∪can␈α∩easily␈α∪insert␈α∩the
␈↓ ↓H␈↓β␈↓ β(missing␈α∪bracket.␈α∩ It␈α∪moves␈α∪the␈α∩arm␈α∪back␈α∪out␈α∩to␈α∪the␈α∪bracket_grasp's␈α∩approach
␈↓ ↓H␈↓β␈↓ β(point at runtime.}
␈↓ ↓H␈↓            WRITE("The bracket is missing.  Position it and type `1' to try again");
␈↓ ↓H␈↓            READ(flag);
␈↓ ↓H␈↓            IF flag ≠ 1 THEN ABORT ("Giving up; you didn't type `1'");
␈↓ ↓H␈↓␈↓ β(␈↓β{The␈α∃ABORT␈α⊗stops␈α∃everything,␈α⊗saves␈α∃the␈α⊗world,␈α∃and␈α⊗forces␈α∃the␈α⊗operator␈α∃to
␈↓ ↓H␈↓β␈↓ β(deal␈α↔with␈α↔the␈α↔problem␈α↔at␈α↔supervisor␈α↔level,␈α↔possibly␈α↔investigating␈α↔the␈α↔saved
␈↓ ↓H␈↓β␈↓ β(information, reinitializing the world to some previous state and restarting.}
␈↓ ↓H␈↓            MOVE YELLOW TO bracket_grasp DIRECTLY;
␈↓ ↓H␈↓␈↓ β(␈↓β{this results in a simple move without a DEPARTURE or an APPROACH.}
␈↓ ↓H␈↓            CENTER YELLOW
␈↓ ↓H␈↓                ON OPENING=0*CM DO ABORT("I tried twice; I give up!");
␈↓ ↓H␈↓            END missed;

␈↓ ↓H␈↓    YELLOW ←← bracket_grasp;
␈↓ ↓H␈↓␈↓ αH␈↓β{This␈α∩tells␈α∪the␈α∩compiler␈α∩that␈α∪the␈α∩yellow␈α∩arm␈α∪can␈α∩be␈α∩assumed␈α∪to␈α∩be␈α∪at␈α∩bracket_grasp
␈↓ ↓H␈↓β␈↓ αHno␈α∃matter␈α∀how␈α∃control␈α∃got␈α∀here,␈α∃eg.␈α∀possibly␈α∃moving␈α∃away␈α∀and␈α∃retrying␈α∃the␈α∀grasp.
␈↓ ↓H␈↓β␈↓ αHThe␈α↔"←←"␈α↔specifies␈α↔that␈α↔the␈α_planning␈α↔value␈α↔of␈α↔bracket_grasp␈α↔should␈α↔be␈α_used␈α↔to
␈↓ ↓H␈↓β␈↓ αHupdate the compiler's view of where the YELLOW is.}
␈↓ ↓H␈↓    bracket_grasp ← YELLOW;
␈↓ ↓H␈↓Page 112␈α?␈α?␈α?␈α?␈α?␈α?␈α_BOLTING A BRACKET␈↓ λII.1.2



␈↓ ↓H␈↓␈↓ αH␈↓β{This␈α∪generates␈α∀code␈α∪to␈α∪be␈α∀run␈α∪at␈α∪run-time␈α∀which␈α∪updates␈α∪the␈α∀frame␈α∪bracket_grasp
␈↓ ↓H␈↓β␈↓ αH(which␈α∪in␈α∪turn␈α∩updates␈α∪bracket␈α∪and␈α∩bracket_hole).␈α∪ The␈α∪result␈α∩is␈α∪that␈α∪the␈α∩following
␈↓ ↓H␈↓β␈↓ αHAFFIX uses the best run-time value of the bracket's position.}
␈↓ ↓H␈↓    AFFIX bracket TO YELLOW;
␈↓ ↓H␈↓    MOVE bracket_hole TO beam_hole + VECTOR(0, 0, 1.3) WRT beam_hole;
␈↓ ↓H␈↓␈↓ αH␈↓β{This␈α~uses␈α→the␈α~STATION's␈α→DEPARTURE␈α~(since␈α→the␈α~bracket␈α→is␈α~not␈α~affixed␈α→to
␈↓ ↓H␈↓β␈↓ αHanything)␈α⊃and␈α⊃the␈α⊃beam_hole's␈α⊃approach␈α⊃(since␈α⊃it␈α⊃is␈α⊃the␈α⊃only␈α⊃frame␈α⊃mentioned␈α⊃in␈α⊂the
␈↓ ↓H␈↓β␈↓ αHdestination).␈α∩ This␈α∩move␈α∩should␈α⊃position␈α∩the␈α∩bracket␈α∩just␈α⊃off␈α∩of␈α∩the␈α∩beam.␈α∩ The␈α⊃next
␈↓ ↓H␈↓β␈↓ αHmotion pushes it up against the beam.}
␈↓ ↓H␈↓    MOVE YELLOW TO ⊗ + VECTOR(0, 0, .5) WRT beam_hole
␈↓ ↓H␈↓        ON FORCE(Z WRT beam_hole) > 50*OZ DO STOP YELLOW
␈↓ ↓H␈↓        ON ARRIVAL DO ABORT ("I seem to have gone too far");
␈↓ ↓H␈↓␈↓ αH␈↓β{Give␈α⊃up␈α⊃if␈α⊂the␈α⊃expected␈α⊃force␈α⊃is␈α⊂not␈α⊃felt.␈α⊃ "ARRIVAL"␈α⊂means␈α⊃that␈α⊃the␈α⊃arm␈α⊂reached
␈↓ ↓H␈↓β␈↓ αHits␈α∩destination␈α⊃without␈α∩being␈α∩stopped␈α⊃by␈α∩any␈α⊃of␈α∩the␈α∩condition␈α⊃monitors.␈α∩ In␈α∩this␈α⊃case
␈↓ ↓H␈↓β␈↓ αHthis␈α~means␈α~that␈α~the␈α≠arm␈α~did␈α~not␈α~reach␈α≠the␈α~expected␈α~force,␈α~which␈α≠means␈α~that
␈↓ ↓H␈↓β␈↓ αHsomething␈α∩went␈α∩wrong.␈α∩ The␈α∩STOP␈α∩YELLOW␈α∩disables␈α∩all␈α∩condition␈α∩monitors␈α∩for␈α∩the
␈↓ ↓H␈↓β␈↓ αHyellow arm.}
␈↓ ↓H␈↓    END ypickup;

␈↓ ↓H␈↓    bpickup: BEGIN {pick up bolt by BLUE}
␈↓ ↓H␈↓␈↓ αH␈↓β{Meanwhile the BLUE arm can be picking up the bolt.}
␈↓ ↓H␈↓    OPERATE BFINGERS WITH OPENING=3*CM;
␈↓ ↓H␈↓    MOVE BLUE TO bolt;
␈↓ ↓H␈↓    CENTER BLUE;
␈↓ ↓H␈↓␈↓ αH␈↓β{Assume everything is OK.}
␈↓ ↓H␈↓    bolt ← BLUE;
␈↓ ↓H␈↓    AFFIX bolt TO STATION;
␈↓ ↓H␈↓    END bpickup
␈↓ ↓H␈↓COEND positioning;

␈↓ ↓H␈↓␈↓β{The␈α⊃bracket␈α⊃should␈α∩be␈α⊃positioned␈α⊃next␈α∩to␈α⊃the␈α⊃beam␈α∩and␈α⊃the␈α⊃BLUE␈α∩arm␈α⊃should␈α⊃be␈α∩holding␈α⊃the
␈↓ ↓H␈↓βbolt.}

␈↓ ↓H␈↓MOVE bolt TO beam_hole + VECTOR(0, 0, -5.3) WRT beam_hole
␈↓ ↓H␈↓    WITH DEPROACH(beam_hole);
␈↓ ↓H␈↓␈↓ αλ␈↓β{This should position the bolt .3 centimeter off of the bracket.}

␈↓ ↓H␈↓␈↓β{Now␈α∀begin␈α∃a␈α∀search␈α∃just␈α∀in␈α∃case␈α∀the␈α∃bolt␈α∀doesn't␈α∃immediately␈α∀go␈α∃in␈α∀the␈α∃hole:␈α∀make␈α∃.2␈α∀cm
␈↓ ↓H␈↓βsteps around in a spiral; if the bolt does not go in within nine tries, abort the program.}
␈↓ ↓H␈↓FRAME set; SCALAR n;
␈↓ ↓H␈↓␈↓ αλ␈↓β{n is the number of attempts.}
␈↓ ↓H␈↓n ← 0;
␈↓ ↓H␈↓set ← BLUE;
␈↓ ↓H␈↓␈↓ αλ␈↓β{Save initial arm position.}
␈↓ ↓H␈↓SEARCH BLUE
␈↓ ↓H␈↓    INCREMENT .2*CM
␈↓ ↓H␈↓    ACROSS PLANE(NILVEC,Z WRT beam_hole)
␈↓ ↓H␈↓    REPEATING
␈↓ ↓H␈↓        inserting: BEGIN
␈↓ ↓H␈↓II.1.2␈α?␈α?␈α?␈α?␈α?␈α?␈α(BOLTING A BRACKET␈↓ 
RPage 113



␈↓ ↓H␈↓        MOVE BLUE TO ⊗ + VECTOR(0, 0, 1.6) WRT beam_hole
␈↓ ↓H␈↓            ON FORCE(Z WRT beam_hole) > 60*OZ DO
␈↓ ↓H␈↓                missed: BEGIN
␈↓ ↓H␈↓                STOP BLUE;
␈↓ ↓H␈↓                n ← n + 1;
␈↓ ↓H␈↓                IF n > 9 THEN ABORT ("Giving up the search");
␈↓ ↓H␈↓                MOVE BLUE TO set
␈↓ ↓H␈↓                END missed
␈↓ ↓H␈↓            ON ARRIVAL DO TERMINATE;
␈↓ ↓H␈↓␈↓ β(␈↓β{This␈α⊃means␈α⊂that␈α⊃if␈α⊂the␈α⊃MOVE␈α⊂succeeds␈α⊃in␈α⊂reaching␈α⊃its␈α⊂goal,␈α⊃stop␈α⊃the␈α⊂search.
␈↓ ↓H␈↓β␈↓ β(TERMINATE is a key word within SEARCHs.}
␈↓ ↓H␈↓        END inserting;

␈↓ ↓H␈↓BLUE ←← beam_hole + VECTOR(0, 0, 3.7) WRT beam_hole;
␈↓ ↓H␈↓␈↓ αλ␈↓β{Expect to have the bolt (which is 4 cm long) .3 cm into the hole.}

␈↓ ↓H␈↓MOVE BLUE TO ⊗ * FRAME(ROT(Z, 90*DEG), VECTOR(0, 0, 4))
␈↓ ↓H␈↓    WITH FORCE = 0 ALONG X,Y OF BLUE
␈↓ ↓H␈↓    ON FORCE(Z WRT BLUE) > 60*OZ DO STOP BLUE;
␈↓ ↓H␈↓␈↓ αH␈↓β{This␈α⊃moves␈α⊃the␈α⊃arm␈α⊃4␈α⊃cm␈α⊃straight␈α∩ahead␈α⊃and␈α⊃twists␈α⊃it␈α⊃90␈α⊃degrees␈α⊃about␈α⊃its␈α∩Z␈α⊃axis
␈↓ ↓H␈↓β␈↓ αH(ie. straight ahead).  Thus it moves ahead and twists.}

␈↓ ↓H␈↓disengage: COBEGIN
␈↓ ↓H␈↓    foryellow: BEGIN
␈↓ ↓H␈↓    OPERATE YFINGERS WITH OPENING = 3*CM;
␈↓ ↓H␈↓    UNFIX bracket FROM YELLOW;
␈↓ ↓H␈↓    AFFIX bracket TO beam;
␈↓ ↓H␈↓    MOVE YELLOW TO YPARK
␈↓ ↓H␈↓    END foryellow;

␈↓ ↓H␈↓    forblue: BEGIN
␈↓ ↓H␈↓    OPERATE BFINGERS WITH OPENING = 3*CM;
␈↓ ↓H␈↓    UNFIX bolt FROM BLUE;
␈↓ ↓H␈↓    AFFIX bolt TO beam;
␈↓ ↓H␈↓    MOVE BLUE TO BPARK
␈↓ ↓H␈↓    END forblue
␈↓ ↓H␈↓COEND disengage;
␈↓ ↓H␈↓WRITE("Finished");
␈↓ ↓H␈↓END;



␈↓ ↓H␈↓␈↓βII.1.3     EXAMPLE THREE␈↓


␈↓ ↓H␈↓This␈α⊃example␈α⊃employs␈α⊃a␈α⊃text␈α⊂macro␈α⊃to␈α⊃simplify␈α⊃definitions,␈α⊃a␈α⊂macro␈α⊃to␈α⊃shorten␈α⊃the␈α⊃code␈α⊂for
␈↓ ↓H␈↓searching,␈α⊂and␈α⊂a␈α⊂library␈α⊂routine␈α⊂to␈α⊂grasp␈α⊂things.␈α⊂ The␈α⊂library␈α⊂routine␈α⊂is␈α⊂supposed␈α⊂to␈α⊃cover␈α⊂a
␈↓ ↓H␈↓number␈α∞of␈α
possibilities␈α∞and␈α
provide␈α∞for␈α
a␈α∞number␈α
of␈α∞parameters.␈α
 Since␈α∞library␈α
routines␈α∞can␈α
be
␈↓ ↓H␈↓Page 114␈α?␈α?␈α?␈α?␈α?␈α?␈α_BOLTING A BRACKET␈↓ λII.1.3



␈↓ ↓H␈↓called␈α∂with␈α∂a␈α∂subset␈α∂of␈α∂their␈α∂parameters␈α∂filled␈α∂in,␈α∂the␈α∂routine's␈α∂flexibility␈α∂is␈α∂not␈α∂oppressive␈α∞for
␈↓ ↓H␈↓those users who just want to do something simple.

␈↓ ↓H␈↓DEFINE define_wrt(new_frame, main_frame, position) =
␈↓ ↓H␈↓        "new_frame ← main_frame * position;
␈↓ ↓H␈↓         AFFIX new_frame TO main_frame";

␈↓ ↓H␈↓A typical call might be:

␈↓ ↓H␈↓        define_wrt(bracket_hole, bracket, FRAME(ROT(X, 180*DEG), VECTOR(5.1, 2, 0));

␈↓ ↓H␈↓which would expand into:

␈↓ ↓H␈↓        bracket_hole ← bracket * FRAME(ROT(X, 180*DEG), VECTOR(5.1, 2, 0));
␈↓ ↓H␈↓        AFFIX bracket_hole TO bracket;



␈↓ ↓H␈↓The␈αfollowing␈αmacro␈αproduces␈αa␈αstring␈αof␈αtokens␈αwhich␈αimply␈αa␈αcompile-time␈αcheck␈αon␈αthe␈αvalue
␈↓ ↓H␈↓of␈α∞the␈α∞conditional␈α∞expanded␈α∞by␈α∞the␈α∞parameter␈α∞RIGID.␈α∞ If␈α∞RIGID␈α∞evaluates␈α∞to␈α∞TRUE␈α∞then␈α∞the
␈↓ ↓H␈↓token sequence which rigidly affixes the new frame to the main frame is used.

␈↓ ↓H␈↓DEFINE DEFINE_WRT(new_frame, main_frame, position, rigid) =
␈↓ ↓H␈↓   "new_frame ← main_frame * position;
␈↓ ↓H␈↓    PLAN IF rigid
␈↓ ↓H␈↓        THEN AFFIX new_frame TO main_frame RIGIDLY
␈↓ ↓H␈↓        ELSE AFFIX new_frame TO main_frame";



␈↓ ↓H␈↓Another, more complicated macro to facilitate a normal search:

␈↓ ↓H␈↓DEFINE normal_search(the_arm, increm, dist_fwd, stopping_force, num_tries) =
␈↓ ↓H␈↓        "BEGIN  {␈↓βThis BEGIN is part of the macro code.␈↓}
␈↓ ↓H␈↓         FRAME set; SCALAR n;
␈↓ ↓H␈↓␈↓ αh␈↓β{n is the number of attempts.}
␈↓ ↓H␈↓        n ← 0;
␈↓ ↓H␈↓        set ← the_arm;
␈↓ ↓H␈↓␈↓ αh␈↓β{Save initial arm position.}
␈↓ ↓H␈↓        SEARCH the_arm
␈↓ ↓H␈↓            INCREMENT increm
␈↓ ↓H␈↓            ACROSS PLANE(NILVEC, Z WRT the_arm)
␈↓ ↓H␈↓            REPEATING
␈↓ ↓H␈↓                insertion: BEGIN
␈↓ ↓H␈↓                MOVE the_arm TO ⊗ + (dist_fwd*Z) WRT the_arm
␈↓ ↓H␈↓                    ON FORCE(Z WRT the_arm) > stopping_force DO
␈↓ ↓H␈↓                        missed: BEGIN
␈↓ ↓H␈↓                        STOP the_arm;
␈↓ ↓H␈↓                        n ← n + 1;
␈↓ ↓H␈↓II.1.3␈α?␈α?␈α?␈α?␈α?␈α?␈α(BOLTING A BRACKET␈↓ 
RPage 115



␈↓ ↓H␈↓                        IF n > num_tries THEN ABORT(""Giving up"");
␈↓ ↓H␈↓                        MOVE the_arm TO set;
␈↓ ↓H␈↓                        END missed
␈↓ ↓H␈↓                    ON ARRIVAL DO TERMINATE
␈↓ ↓H␈↓                END insertion;
␈↓ ↓H␈↓        ASSERT the_arm =  (SET) +  VECTOR(0, 0, dist_fwd);
␈↓ ↓H␈↓␈↓ αh␈↓β{This␈α∃changes␈α∃the␈α∃compiler's␈α⊗view␈α∃to␈α∃believe␈α∃that␈α⊗the␈α∃arm␈α∃succeeds␈α∃on␈α⊗the␈α∃first
␈↓ ↓H␈↓β␈↓ αhattempt,␈α∪and␈α∪hence␈α∩the␈α∪planning␈α∪value␈α∩for␈α∪the␈α∪arm␈α∩will␈α∪be␈α∪set␈α∩to␈α∪SET␈α∪plus␈α∩the
␈↓ ↓H␈↓β␈↓ αhdistance forward.}
␈↓ ↓H␈↓    END";


␈↓ ↓H␈↓Notice␈αthat␈αa␈αpair␈αof␈αadjacent␈αquotes␈αinside␈αof␈αa␈αmacro␈αdefinition␈α(delimited␈αby␈αquotes)␈αdenotes␈αa
␈↓ ↓H␈↓single quote.

␈↓ ↓H␈↓A typical call would be:
␈↓ ↓H␈↓        normal_search(YELLOW, .2*CM, 1.6*CM, 60*OZ, 9);



␈↓ ↓H␈↓The above macro could easily be made into a library routine as follows:

␈↓ ↓H␈↓ROUTINE normal_search(FRAME the_arm; SCALAR increm, dist_fwd,
␈↓ ↓H␈↓                        stopping_force, num_tries(DEFAULT 9));
␈↓ ↓H␈↓    BEGIN
␈↓ ↓H␈↓    :
␈↓ ↓H␈↓    END;

␈↓ ↓H␈↓The corresponding call:

␈↓ ↓H␈↓        normal_search(YELLOW, .2*CM, 1.6*CM, 60*OZ, 9);


␈↓ ↓H␈↓The␈α
"9"␈α
is␈α
a␈α
default␈α
value␈α
if␈α
no␈α
value␈α
is␈α
specified␈α
in␈α
the␈α
call.␈α
 Thus,␈α
by␈α
naming␈α
the␈αparameters␈α
the
␈↓ ↓H␈↓same call can be made by:

␈↓ ↓H␈↓        normal_search(the_arm=YELLOW, dist_fwd=1.6*CM,
␈↓ ↓H␈↓            stopping_force=60*OZ, increm=.2*CM);

␈↓ ↓H␈↓Notice that the order is not important if the parameters are named.





␈↓ ↓H␈↓The following routine is a library routine to grasp things.  Basically it does the following:

␈↓ ↓H␈↓␈↓ αH(1) Optionally open to an opening_before_departure.
␈↓ ↓H␈↓Page 116␈α?␈α?␈α?␈α?␈α?␈α?␈α_BOLTING A BRACKET␈↓ λII.1.3



␈↓ ↓H␈↓␈↓ αH(2) Depart via a departure (if there is one; a special_departure can be specified).

␈↓ ↓H␈↓␈↓ αH(3)␈α⊂Start␈α∂opening␈α⊂the␈α∂fingers␈α⊂to␈α⊂the␈α∂opening_for_approach␈α⊂at␈α∂the␈α⊂departure␈α⊂point␈α∂(if
␈↓ ↓H␈↓␈↓ βλspecial_departure␈α∂is␈α⊂specified,␈α∂use␈α⊂it.␈α∂ Otherwise,␈α⊂use␈α∂the␈α⊂standard␈α∂DEPROACH
␈↓ ↓H␈↓␈↓ βλvalue.).

␈↓ ↓H␈↓␈↓ αH(4)␈α⊗Approach␈α∃the␈α⊗grasping_point␈α∃via␈α⊗the␈α∃APPROACH␈α⊗(if␈α∃a␈α⊗special_approach␈α∃is
␈↓ ↓H␈↓␈↓ βλspecified, use it).

␈↓ ↓H␈↓␈↓ αH(5)␈αCenter␈α
on␈αthe␈α
object.␈α(If␈α
the␈αfingers␈αclose␈α
so␈αthat␈α
the␈αopening␈α
is␈αless␈αthan␈α
(thickness -
␈↓ ↓H␈↓␈↓ βλ .10)␈α∞call␈α
the␈α∞operator␈α
and␈α∞give␈α∞him␈α
one␈α∞chance␈α
to␈α∞re-position␈α
the␈α∞object␈α∞and␈α
try
␈↓ ↓H␈↓␈↓ βλagain.)

␈↓ ↓H␈↓␈↓ αH(6)␈α∩Upon␈α∩successfully␈α∩centering␈α∩on␈α∪the␈α∩grasp_point,␈α∩update␈α∩the␈α∩object's␈α∪position␈α∩by
␈↓ ↓H␈↓␈↓ βλassigning␈α∞the␈α∞grasp_point␈α∞the␈α∞current␈α
hand␈α∞location␈α∞(this,␈α∞of␈α∞course,␈α∞assumes␈α
that
␈↓ ↓H␈↓␈↓ βλeither␈αthe␈αgrasp_point␈α
and␈αthe␈αobject␈αare␈α
the␈αsame␈αframe␈α
or␈αthat␈αthe␈αgrasp_point␈α
is
␈↓ ↓H␈↓␈↓ βλRIGIDLY affixed to the object).
␈↓ ↓H␈↓Notice that this routine can be used by either arm.

␈↓ ↓H␈↓ROUTINE grasp(TRANS special_departure, special_approach;
␈↓ ↓H␈↓              FRAME ATOM the_arm (DEFAULT YELLOW);
␈↓ ↓H␈↓              FRAME object, grasp_point, thing_object_affixed_to;
␈↓ ↓H␈↓              DISTANCE SCALAR opening_before_departure,
␈↓ ↓H␈↓                  opening_for_approach(DEFAULT 15*CM),
␈↓ ↓H␈↓                  thickness(DEFAULT .3*CM));
␈↓ ↓H␈↓␈↓ αH␈↓β{Special_departure␈α+is␈α+a␈α+trans␈α+for␈α+the␈α+relative␈α+position␈α+of␈α+departure.
␈↓ ↓H␈↓β␈↓ αHSpecial_approach␈α&is␈α&a␈α&trans␈α&for␈α%the␈α&relative␈α&position␈α&of␈α&the␈α%approach.
␈↓ ↓H␈↓β␈↓ αHThing_object_affixed_to␈α∃is␈α∃the␈α∃name␈α∀of␈α∃the␈α∃frame␈α∃that␈α∀the␈α∃object␈α∃is␈α∃affixed␈α∃to␈α∀(if
␈↓ ↓H␈↓β␈↓ αHthere␈α⊃is␈α⊃one)␈α⊃before␈α⊃the␈α⊂grasp␈α⊃routine␈α⊃is␈α⊃called.␈α⊃ It␈α⊂is␈α⊃used␈α⊃to␈α⊃specify␈α⊃from␈α⊃what␈α⊂the
␈↓ ↓H␈↓β␈↓ αHobject␈α∀should␈α∪be␈α∀unfixed␈α∪upon␈α∀being␈α∀grasped.␈α∪ Thickness␈α∀is␈α∪defaulted␈α∀to␈α∀.3*CM␈α∪so
␈↓ ↓H␈↓β␈↓ αHthat␈α⊗the␈α⊗condition␈α⊗monitor␈α⊗ON OPENING < (thickness - .2*CM) DO␈α⊗...␈α⊗will␈α⊗do␈α⊗a
␈↓ ↓H␈↓β␈↓ αHreasonable thing.}

␈↓ ↓H␈↓    grasping: BEGIN
␈↓ ↓H␈↓    ATOM the_fingers;
␈↓ ↓H␈↓    CLAUSE t, u;
␈↓ ↓H␈↓    PLAN IF #(the_arm) = BLUE
␈↓ ↓H␈↓        THEN the_fingers ←← BFINGERS
␈↓ ↓H␈↓        ELSE the_fingers ←← YFINGERS;
␈↓ ↓H␈↓␈↓ αH␈↓β{This␈α∪sets␈α∪up␈α∀the␈α∪atom␈α∪the_fingers␈α∀to␈α∪expand␈α∪into␈α∪the␈α∀correct␈α∪device␈α∪name␈α∀for␈α∪the
␈↓ ↓H␈↓β␈↓ αHOPERATE statements (depending upon the choice of arm).}
␈↓ ↓H␈↓    PLAN IF SPECIFIED(opening_before_departure) THEN
␈↓ ↓H␈↓        OPERATE #(the_fingers) WITH OPENING=opening_before_departure;

␈↓ ↓H␈↓␈↓ αH␈↓β{The␈α'next␈α&statement␈α'sets␈α&up␈α'a␈α&clause,␈α'u,␈α&which␈α'contains␈α'the␈α&phrase
␈↓ ↓H␈↓β␈↓ αH"WITH APPROACH = <the␈α∀special>"␈α∀or␈α∪NILDEPROACH␈α∀depending␈α∀upon␈α∪whether
␈↓ ↓H␈↓β␈↓ αHor␈α∀not␈α∀a␈α∀special␈α∀approach␈α∀has␈α∀been␈α∀specified.␈α∀ This␈α∀constructed␈α∀phrase␈α∀is␈α∀used␈α∀in
␈↓ ↓H␈↓β␈↓ αHtwo or three places below to insure that the desired approach is being used.}
␈↓ ↓H␈↓    PLAN IF SPECIFIED(special_approach)
␈↓ ↓H␈↓II.1.3␈α?␈α?␈α?␈α?␈α?␈α?␈α(BOLTING A BRACKET␈↓ 
RPage 117



␈↓ ↓H␈↓        THEN u ←← CLAUSE(WITH APPROACH = special_approach )
␈↓ ↓H␈↓        ELSE u ←← NILCLAUSE;
␈↓ ↓H␈↓    PLAN IF SPECIFIED(special_departure)
␈↓ ↓H␈↓        THEN MOVE #(the_arm) TO grasp_point
␈↓ ↓H␈↓                WITH DEPARTURE=NILDEPROACH
␈↓ ↓H␈↓                VIA #(the_arm) * special_departure THEN
␈↓ ↓H␈↓                    BEGIN
␈↓ ↓H␈↓                    OPERATE #(the_fingers)
␈↓ ↓H␈↓                        WITH OPENING=opening_for_approach
␈↓ ↓H␈↓                    END
␈↓ ↓H␈↓                #(u)
␈↓ ↓H␈↓        ELSE MOVE #(the_arm) TO grasp_point
␈↓ ↓H␈↓                WITH DEPARTURE=NILDEPROACH
␈↓ ↓H␈↓                VIA #(the_arm) * DEPROACH(grasp_point) THEN
␈↓ ↓H␈↓                    BEGIN
␈↓ ↓H␈↓                    OPERATE #(the_fingers)
␈↓ ↓H␈↓                        WITH OPENING=opening_for_approach
␈↓ ↓H␈↓                    END
␈↓ ↓H␈↓                #(u);

␈↓ ↓H␈↓    CENTER #(the_arm)
␈↓ ↓H␈↓        ON OPENING < (THICKNESS-.2*CM) DO
␈↓ ↓H␈↓            missed: BEGIN
␈↓ ↓H␈↓            STOP #(the_arm);
␈↓ ↓H␈↓            SCALAR flag;
␈↓ ↓H␈↓            OPERATE the_fingers WITH OPENING=opening_for_approach;
␈↓ ↓H␈↓            PLAN IF SPECIFIED(special_approach)
␈↓ ↓H␈↓                THEN BEGIN {␈↓βmove to special approach point␈↓}
␈↓ ↓H␈↓                        MOVE #(the_arm) TO #(the_arm) * special_approach
␈↓ ↓H␈↓                                DIRECTLY
␈↓ ↓H␈↓                     END
␈↓ ↓H␈↓                ELSE BEGIN {␈↓βuse the normal approach␈↓}
␈↓ ↓H␈↓                        MOVE #(the_arm)
␈↓ ↓H␈↓                            TO #(the_arm)* DEPROACH(grasp_point)
␈↓ ↓H␈↓                            DIRECTLY;
␈↓ ↓H␈↓                     END
␈↓ ↓H␈↓            WRITE("Grasp failed; Type a `1' to retry");
␈↓ ↓H␈↓            READ(flag);
␈↓ ↓H␈↓␈↓ βλ␈↓β{This is simply "wait for proceed".}
␈↓ ↓H␈↓            IF flag ≠ 1 THEN ABORT;
␈↓ ↓H␈↓            MOVE #(the_arm) TO grasp_point DIRECTLY;
␈↓ ↓H␈↓            CENTER #(the_arm)
␈↓ ↓H␈↓                ON OPENING < (THICKNESS-.2*CM) DO ABORT ("Closed on air");
␈↓ ↓H␈↓            END missed;

␈↓ ↓H␈↓    grasp_point ← #(the_arm);
␈↓ ↓H␈↓    PLAN IF SPECIFIED(thing_object_affixed_to) THEN
␈↓ ↓H␈↓        UNFIX object FROM thing_object_affixed_to;
␈↓ ↓H␈↓    AFFIX object TO #(the_arm);
␈↓ ↓H␈↓Page 118␈α?␈α?␈α?␈α?␈α?␈α?␈α_BOLTING A BRACKET␈↓ λII.1.3



␈↓ ↓H␈↓    END grasping;

␈↓ ↓H␈↓The following is a typical call on such a routine:

␈↓ ↓H␈↓        grasp(the_arm=YELLOW, object=bracket,
␈↓ ↓H␈↓                grasp_point=bracket_grasp,
␈↓ ↓H␈↓                special_approach=FRAME(ROT(Z,90*DEG),VECTOR(0,0,-3)),
␈↓ ↓H␈↓                opening_for_approach=3*CM);

␈↓ ↓H␈↓which expands into:

␈↓ ↓H␈↓        MOVE YELLOW TO bracket_grasp
␈↓ ↓H␈↓            WITH DEPARTURE=NILDEPROACH
␈↓ ↓H␈↓            VIA YELLOW * FRAME(NILROT,10*Z) THEN
␈↓ ↓H␈↓                BEGIN
␈↓ ↓H␈↓                OPERATE YFINGERS WITH OPENING=3*CM
␈↓ ↓H␈↓                END
␈↓ ↓H␈↓            WITH APPROACH = FRAME(ROT(Z,90*DEG), VECTOR(0,0,-3));
␈↓ ↓H␈↓        CENTER YELLOW
␈↓ ↓H␈↓            ON OPENING < .2*CM DO
␈↓ ↓H␈↓                missed: BEGIN
␈↓ ↓H␈↓                STOP YELLOW;
␈↓ ↓H␈↓                SCALAR flag;
␈↓ ↓H␈↓                OPERATE YFINGERS WITH OPENING=3*CM;
␈↓ ↓H␈↓                MOVE YELLOW
␈↓ ↓H␈↓                    TO YELLOW*FRAME(ROT(Z,90*DEG), VECTOR(0, 0, -3))
␈↓ ↓H␈↓                    DIRECTLY;
␈↓ ↓H␈↓                WRITE("Grasp failed; Type a `1' to retry");
␈↓ ↓H␈↓                READ(flag);
␈↓ ↓H␈↓                IF flag ≠ 1 THEN ABORT;
␈↓ ↓H␈↓                MOVE YELLOW TO bracket_grasp DIRECTLY;
␈↓ ↓H␈↓                CENTER YELLOW
␈↓ ↓H␈↓                    ON OPENING < .2*CM DO ABORT ("Closed on air");
␈↓ ↓H␈↓                END missed;
␈↓ ↓H␈↓        bracket_grasp ← YELLOW;
␈↓ ↓H␈↓        AFFIX bracket TO YELLOW;



␈↓ ↓H␈↓Finally,␈α∂the␈α∂whole␈α∂task␈α∂is␈α∂made␈α∂into␈α∂a␈α∂library␈α∂routine␈α∂so␈α∂it␈α∂can␈α∂be␈α∂`called'␈α∂(ie.␈α∂expanded)␈α⊂as␈α∂a
␈↓ ↓H␈↓subtask from a higher level task.

␈↓ ↓H␈↓DEFINE OZ="((72.007789*GM*CM)/(SEC*SEC))";

␈↓ ↓H␈↓ROUTINE bolt_on_bracket;
␈↓ ↓H␈↓    whole_task: BEGIN
␈↓ ↓H␈↓    PLAN IF #(YELLOW) ≠ YPARK
␈↓ ↓H␈↓        THEN PLAN ERROR("The yellow arm is not planned to be in its
␈↓ ↓H␈↓            park position, contrary to assumption in routine bolt_on_bracket");
␈↓ ↓H␈↓II.1.3␈α?␈α?␈α?␈α?␈α?␈α?␈α(BOLTING A BRACKET␈↓ 
RPage 119



␈↓ ↓H␈↓    PLAN IF FORM(AFFIXED, ANYTHING, YELLOW)
␈↓ ↓H␈↓        THEN PLAN ERROR("Something is affixed to the yellow hand;
␈↓ ↓H␈↓            the routine bolt_on_bracket expects the hand to be empty.");
␈↓ ↓H␈↓␈↓ αh␈↓β{This␈α↔type␈α↔of␈α↔compile-time␈α_check␈α↔and␈α↔warning␈α↔to␈α_the␈α↔user␈α↔is␈α↔very␈α_useful␈α↔for
␈↓ ↓H␈↓β␈↓ αhinsuring␈α↔that␈α_the␈α↔interface␈α↔assumptions␈α_for␈α↔routines␈α↔are␈α_met␈α↔in␈α_the␈α↔planning
␈↓ ↓H␈↓β␈↓ αhworld␈α≠just␈α≠before␈α≠the␈α≠routine␈α≠is␈α≠expanded.␈α≠ Notice␈α≠that␈α≠there␈α≠is␈α≠a␈α≠built-in
␈↓ ↓H␈↓β␈↓ αhprocedure,␈α⊃PLAN␈α⊃ERROR,␈α⊃which␈α⊃prints␈α⊃the␈α⊃included␈α⊃message␈α⊃at␈α⊃compile-time␈α⊂and
␈↓ ↓H␈↓β␈↓ αhstops␈α↔the␈α↔compilation.␈α↔ There␈α↔is␈α↔also␈α↔a␈α↔compile-time␈α↔WRITE␈α_statement,␈α↔PLAN
␈↓ ↓H␈↓β␈↓ αhWRITE("...").␈α∀ These␈α∪two␈α∀different␈α∪`output'␈α∀statements␈α∪are␈α∀used␈α∪so␈α∀that␈α∀the␈α∪user
␈↓ ↓H␈↓β␈↓ αhcan generate WRITE statements during the compilation of a program.}

␈↓ ↓H␈↓    COBEGIN
␈↓ ↓H␈↓        ypickup: BEGIN {␈↓βPick up bracket with YELLOW␈↓}
␈↓ ↓H␈↓        grasp(grasp_point=bracket_grasp, object=bracket,
␈↓ ↓H␈↓            opening_for_approach=3*CM);
␈↓ ↓H␈↓        MOVE bracket_hole TO beam_hole + VECTOR(0, 0, 1.3) WRT beam_hole;
␈↓ ↓H␈↓        MOVE YELLOW TO ⊗ + VECTOR(0, 0, .5) WRT beam_hole
␈↓ ↓H␈↓            ON FORCE(Z WRT beam_hole) > 50*OZ DO STOP YELLOW
␈↓ ↓H␈↓            ON ARRIVAL DO ABORT("I Seem to have gone too far.");
␈↓ ↓H␈↓        END ypickup;

␈↓ ↓H␈↓        bpickup: BEGIN {␈↓βPick up bolt with BLUE␈↓}
␈↓ ↓H␈↓        grasp(the_arm=BLUE, object=bolt, grasp_point=bolt,
␈↓ ↓H␈↓            opening_for_approach=3*CM)
␈↓ ↓H␈↓        END bpickup
␈↓ ↓H␈↓    COEND;

␈↓ ↓H␈↓    MOVE bolt TO beam_hole + VECTOR(0, 0, -5.3) WRT beam_hole;
␈↓ ↓H␈↓    normal_search(BLUE, .2*CM, 1.6*CM, 60*OZ, 9);
␈↓ ↓H␈↓␈↓ αH␈↓β{Assume that the bolt is now in the hole.}
␈↓ ↓H␈↓    MOVE BLUE TO ⊗ * FRAME(ROT(Z,90*DEG), VECTOR(0, 0, 4))
␈↓ ↓H␈↓        ON FORCE(Z WRT BLUE) > 60*OZ DO STOP BLUE;

␈↓ ↓H␈↓    disengage: COBEGIN
␈↓ ↓H␈↓        foryellow: BEGIN
␈↓ ↓H␈↓        OPERATE YFINGERS WITH OPENING = 3*CM;
␈↓ ↓H␈↓        UNFIX bracket FROM YELLOW;
␈↓ ↓H␈↓        AFFIX bracket TO beam;
␈↓ ↓H␈↓        MOVE YELLOW TO YPARK
␈↓ ↓H␈↓        END foryellow;

␈↓ ↓H␈↓        forblue: BEGIN
␈↓ ↓H␈↓        OPERATE BFINGERS WITH OPENING = 3*CM;
␈↓ ↓H␈↓        UNFIX bolt FROM BLUE;
␈↓ ↓H␈↓        AFFIX bolt TO beam;
␈↓ ↓H␈↓        MOVE BLUE TO BPARK
␈↓ ↓H␈↓        END forblue
␈↓ ↓H␈↓    COEND disengage
␈↓ ↓H␈↓END whole_task;
␈↓ ↓H␈↓Page 120␈α?␈α?␈α?␈α?␈α?␈α?␈α_BOLTING A BRACKET␈↓ λII.1.3



␈↓ ↓H␈↓␈↓∧II.2      EXAMPLES OF COORDINATED ACTION␈↓


␈↓ ↓H␈↓These␈αtwo␈α
examples␈αtake␈αinto␈α
account␈αsome␈αof␈α
the␈αmore␈α
subtle␈αaspects␈αof␈α
assembly␈αsuch␈αas␈α
freeing
␈↓ ↓H␈↓the␈α⊂bracket␈α⊂while␈α⊂trying␈α⊂to␈α⊂insert␈α⊂the␈α⊂bolt␈α⊂in␈α⊂the␈α⊂hole␈α⊂and␈α⊂changing␈α⊂the␈α⊂speed␈α⊂of␈α⊃the␈α⊂driver
␈↓ ↓H␈↓dynamically.

␈↓ ↓H␈↓The␈α
following␈αsection␈α
of␈αcode␈α
is␈αdesigned␈α
to␈αsimultaneously␈α
free␈αthe␈α
YELLOW␈αarm␈α
and␈αmove␈α
the
␈↓ ↓H␈↓BLUE␈α⊂arm␈α⊂to␈α⊂insert␈α⊂the␈α⊂bolt.␈α⊂ The␈α⊂freeing␈α⊃of␈α⊂the␈α⊂YELLOW␈α⊂arm␈α⊂is␈α⊂to␈α⊂allow␈α⊂the␈α⊃bracket␈α⊂to
␈↓ ↓H␈↓accommodate slightly along the surface of the beam as the BLUE arm tries to insert the bolt.

␈↓ ↓H␈↓MOVE bolt TO beam_hole + VECTOR(0, 0, -5.3) WRT beam_hole;
␈↓ ↓H␈↓␈↓ αλ␈↓β{Remember that the bolt is in the BLUE hand.}
␈↓ ↓H␈↓MOVE YELLOW TO ⊗
␈↓ ↓H␈↓    WITH FORCE = 0 ALONG X,Y OF beam_hole
␈↓ ↓H␈↓    ON DURATION > 0*SEC DO
␈↓ ↓H␈↓        insertion: BEGIN
␈↓ ↓H␈↓␈↓ αh␈↓β{Notice that "DURATION > 0*SEC" is an approximation to simultaneous motion.}
␈↓ ↓H␈↓        normal_search(BLUE, .2*CM, 1.6*CM, 60*OZ, 9);
␈↓ ↓H␈↓␈↓ αh␈↓β{Assume that the bolt is now in the hole.}
␈↓ ↓H␈↓        MOVE BLUE TO ⊗ * FRAME(ROT(Z,90*DEG), VECTOR(0, 0, 4))
␈↓ ↓H␈↓            ON FORCE(Z WRT BLUE) > 60*OZ DO STOP YELLOW;
␈↓ ↓H␈↓        END insertion
␈↓ ↓H␈↓    ON DURATION > 4*SEC DO ABORT("Operation took too long");
␈↓ ↓H␈↓␈↓ αH␈↓β{The␈α~"ON␈α~DURATION␈α~>␈α~4*SEC␈α~DO␈α→ABORT"␈α~will␈α~generate␈α~an␈α~error␈α~if␈α→the
␈↓ ↓H␈↓β␈↓ αHinsertion␈α∩takes␈α∩more␈α∩than␈α∩4␈α∩seconds.␈α∩ The␈α∩error␈α∩will␈α∩force␈α∩the␈α∩operator␈α∩to␈α∩deal␈α∩with
␈↓ ↓H␈↓β␈↓ αHthe situation at supervisor level.}

␈↓ ↓H␈↓Without the SEARCH this could be accomplished in "weak" synchrony:

␈↓ ↓H␈↓MOVE bolt TO beam_hole + VECTOR(0, 0, -5.3) WRT beam_hole;
␈↓ ↓H␈↓MOVE [BLUE : YELLOW]
␈↓ ↓H␈↓    TO [⊗ + VECTOR(0, 0, 1.6) WRT BLUE : ⊗]
␈↓ ↓H␈↓    WITH [ : FORCE = 0 ALONG X,Y OF beam_hole]
␈↓ ↓H␈↓    ON [FORCE(Z WRT BLUE) > 60*OZ : ] DO [STOP : STOP];


␈↓ ↓H␈↓It␈αis␈αawkward␈αto␈αinclude␈αthe␈αSEARCH␈αin␈αsuch␈αa␈αscheme.␈α In␈αfact,␈αthis␈αtype␈αof␈αcoordination␈αcomes
␈↓ ↓H␈↓up␈αin␈αa␈αnumber␈αof␈αother␈αplaces.␈α For␈αexample,␈αif␈αyou␈αwant␈αto␈αoperate␈αa␈αdevice␈α(eg.␈αthe␈αDRIVER)
␈↓ ↓H␈↓and␈αmove␈αan␈αarm␈α
or␈αcamera␈α"at␈αthe␈αsame␈α
time."␈αEvents␈αand␈αsynchronizing␈αprimitives␈α
have␈αbeen
␈↓ ↓H␈↓added to solve these control problems.  Consider the following way of programming this task:

␈↓ ↓H␈↓EVENT y_ready, b_ready;
␈↓ ↓H␈↓␈↓ αλ␈↓β{y_ready␈α_is␈α_an␈α↔event␈α_signalling␈α_that␈α↔the␈α_YELLOW␈α_arm␈α↔is␈α_ready␈α_to␈α_move.␈α↔ b_ready
␈↓ ↓H␈↓β␈↓ αλindicates that the BLUE arm is ready to move.}
␈↓ ↓H␈↓MOVE bolt TO beam_hole + VECTOR(0, 0, -5.3) WRT beam_hole;
␈↓ ↓H␈↓bolt_insert: COBEGIN
␈↓ ↓H␈↓    free_yellow: BEGIN
␈↓ ↓H␈↓    SIGNAL y_ready;
␈↓ ↓H␈↓II.2␈α?␈α?␈α?␈α?␈α?␈α?␈α(COORDINATED ACTION␈↓ 
RPage 121



␈↓ ↓H␈↓    WAIT b_ready;
␈↓ ↓H␈↓    MOVE YELLOW TO ⊗
␈↓ ↓H␈↓        WITH FORCE = 0 ALONG X,Y OF beam_hole
␈↓ ↓H␈↓        ON DURATION > 4*SEC DO ABORT("Took too long");
␈↓ ↓H␈↓    END free_yellow

␈↓ ↓H␈↓    blue_insert: BEGIN {␈↓βUse blue to insert bolt␈↓}
␈↓ ↓H␈↓    SIGNAL b_ready;
␈↓ ↓H␈↓    WAIT y_ready;
␈↓ ↓H␈↓    normal_search(BLUE, .2*CM, 1.6*CM, 60*OZ, 9);
␈↓ ↓H␈↓␈↓ αH␈↓β{Assume that the bolt is now in the hole.}
␈↓ ↓H␈↓    MOVE BLUE TO ⊗ * FRAME(ROT(Z,90*DEG), VECTOR(0, 0, 4))
␈↓ ↓H␈↓        ON FORCE(Z WRT BLUE) > 60*OZ DO STOP YELLOW;
␈↓ ↓H␈↓    END blue_insert;
␈↓ ↓H␈↓COEND bolt_insert;


␈↓ ↓H␈↓Consider␈αthe␈αproblem␈αof␈α
inserting␈αin␈αa␈αscrew␈αand␈α
checking␈αto␈αmake␈αsure␈α
that␈αit␈αdoes␈αnot␈αbind.␈α
 If,
␈↓ ↓H␈↓after␈α
a␈αshort␈α
time,␈α
the␈αscrew␈α
does␈α
not␈αbind,␈α
the␈α
speed␈αof␈α
the␈α
DRIVER␈αcan␈α
be␈αincreased.␈α
 However,
␈↓ ↓H␈↓if␈α
it␈αDOES␈α
bind,␈α
everything␈αshould␈α
stop␈α
and␈αthe␈α
DRIVER␈αshould␈α
be␈α
reversed␈αto␈α
try␈α
to␈αunbind
␈↓ ↓H␈↓the screw.

␈↓ ↓H␈↓EVENT d_ready, b_ready;
␈↓ ↓H␈↓SCALAR sp, flag;
␈↓ ↓H␈↓sp ← 30;
␈↓ ↓H␈↓flag ← 1;
␈↓ ↓H␈↓WHILE flag DO
␈↓ ↓H␈↓    screw_loop: BEGIN
␈↓ ↓H␈↓    move_screw: COBEGIN {␈↓βMove and screw simultaneously␈↓}
␈↓ ↓H␈↓        drive: BEGIN
␈↓ ↓H␈↓        SIGNAL d_ready;
␈↓ ↓H␈↓        WAIT b_ready;
␈↓ ↓H␈↓        OPERATE DRIVER
␈↓ ↓H␈↓            WITH VELOCITY = sp
␈↓ ↓H␈↓            ON DURATION > 8*SEC DO ABORT("Took too long");
␈↓ ↓H␈↓        END drive

␈↓ ↓H␈↓        downward_force: BEGIN
␈↓ ↓H␈↓        SIGNAL b_ready;
␈↓ ↓H␈↓        WAIT d_ready;
␈↓ ↓H␈↓        MOVE BLUE TO ⊗
␈↓ ↓H␈↓            WITH FORCE = 0 ALONG Z OF BLUE
␈↓ ↓H␈↓            WITH FORCE = 40*OZ ALONG Z OF BLUE
␈↓ ↓H␈↓            bind: ON TORQUE(Z WRT BLUE) > 80*OZ DO
␈↓ ↓H␈↓                bound: BEGIN
␈↓ ↓H␈↓                DISABLE catch_ok;
␈↓ ↓H␈↓                STOP BLUE;
␈↓ ↓H␈↓                STOP DRIVER;
␈↓ ↓H␈↓                COBEGIN {␈↓βTry to unbind by reversing the driver␈↓}
␈↓ ↓H␈↓Page 122␈α?␈α?␈α?␈α?␈α?␈α?␈αλCOORDINATED ACTION␈↓ ≥II.2



␈↓ ↓H␈↓                    unscrew: BEGIN
␈↓ ↓H␈↓                    SIGNAL d_ready;
␈↓ ↓H␈↓                    WAIT b_ready;
␈↓ ↓H␈↓                    sp ← -60;
␈↓ ↓H␈↓                    OPERATE DRIVER
␈↓ ↓H␈↓                        WITH VELOCITY = SP
␈↓ ↓H␈↓                        ON DURATION > 4*SEC DO ABORT("Can't unbind");
␈↓ ↓H␈↓                    END unscrew

␈↓ ↓H␈↓                    upward_force BEGIN
␈↓ ↓H␈↓                    SIGNAL b_ready;
␈↓ ↓H␈↓                    WAIT d_ready;
␈↓ ↓H␈↓                    MOVE BLUE TO ⊗
␈↓ ↓H␈↓                        WITH FORCE = 0 ALONG Y, X OF BLUE
␈↓ ↓H␈↓                        WITH FORCE = 40*OZ ALONG Z OF BLUE
␈↓ ↓H␈↓                        out_ok: ON FORCE(Z WRT BLUE)<20*OZ DO
␈↓ ↓H␈↓                            BEGIN
␈↓ ↓H␈↓                            STOP DRIVER;
␈↓ ↓H␈↓                            STOP BLUE;
␈↓ ↓H␈↓␈↓ ∧(␈↓β{Leave flag true for retry.}
␈↓ ↓H␈↓                            END
␈↓ ↓H␈↓                        too_much_time: ON DURATION>4*SEC DO ABORT;
␈↓ ↓H␈↓                    END upward_force
␈↓ ↓H␈↓                COEND
␈↓ ↓H␈↓                END bound
␈↓ ↓H␈↓            catch_ok: ON DURATION > 1*SEC DO
␈↓ ↓H␈↓                BEGIN
␈↓ ↓H␈↓                DISABLE bind;
␈↓ ↓H␈↓                ENABLE torqued_in_ok;
␈↓ ↓H␈↓                sp ← 60; {maybe this should be CRITICAL.}
␈↓ ↓H␈↓                END
␈↓ ↓H␈↓            torqued_in_ok: DEFER ON TORQUE(Z WRT BLUE) > 80*OZ DO
␈↓ ↓H␈↓                BEGIN
␈↓ ↓H␈↓                STOP DRIVER;
␈↓ ↓H␈↓                STOP BLUE;
␈↓ ↓H␈↓                flag ← 0; {indicating no retry}
␈↓ ↓H␈↓                END;
␈↓ ↓H␈↓        END downward_force
␈↓ ↓H␈↓    COEND move_screw
␈↓ ↓H␈↓    END screw_loop;
␈↓ ↓H␈↓II.3␈α?␈α?␈α?␈α?␈α?␈α'A `VERY HIGH LEVEL' EXAMPLE␈↓ 
RPage 123



␈↓ ↓H␈↓␈↓∧II.3      A `VERY HIGH LEVEL' EXAMPLE␈↓


␈↓ ↓H␈↓This␈αvery␈αshort␈αexample␈αdemonstrates␈αthe␈αuse␈αof␈αassembly-oriented␈αspecial␈αprimitives␈αto␈αsimplify
␈↓ ↓H␈↓a␈α
task␈αspecification,␈α
as␈αwell␈α
as␈αsome␈α
of␈αthe␈α
object␈αdescription␈α
conventions␈αused␈α
by␈αthose␈α
primitives.
␈↓ ↓H␈↓Here,␈αthe␈αtask␈αis␈αthe␈αsame␈αas␈αthat␈αof␈αsubsection␈αII.1.1.␈α For␈αa␈αfuller␈αexplanation␈αof␈αthe␈αuse␈αof␈αsuch
␈↓ ↓H␈↓primitives and another, longer example, see Chapter 4.

␈↓ ↓H␈↓FRAME beam, bracket, bolt;
␈↓ ↓H␈↓FRAME bracket_bore, beam_bore;
␈↓ ↓H␈↓FRAME bolt_grasp, bracket_handle;

␈↓ ↓H␈↓␈↓β{We␈α∃must␈α∃first␈α⊗describe␈α∃the␈α∃various␈α⊗components.␈α∃ We␈α∃expect␈α⊗that␈α∃eventually␈α∃the␈α⊗process␈α∃of
␈↓ ↓H␈↓βmaking␈α∪such␈α∀descriptions␈α∪will␈α∪become␈α∀very␈α∪largely␈α∪automated,␈α∀as␈α∪computer␈α∪programs␈α∀begin␈α∪to
␈↓ ↓H␈↓βplay an increasingly active role in mechanical design. See Section 4.7.}

␈↓ ↓H␈↓ASSERT FORM(TYPE, beam, object);
␈↓ ↓H␈↓ASSERT FORM(GEOMED, beam, "beam.B3D[AL,HE]"); {␈↓βShape description␈↓}
␈↓ ↓H␈↓ASSERT FORM(SUBPART, beam, beam_bore);
␈↓ ↓H␈↓ATTACH beam_bore TO beam RIGIDLY AT TRANS(ROT(Y,90),VECTOR(0,1.5,6));

␈↓ ↓H␈↓ASSERT FORM(TYPE, bracket, object);
␈↓ ↓H␈↓ASSERT FORM(GEOMED, bracket, "BRACK.B3D[AL,HE]"); {␈↓βShape description.␈↓}
␈↓ ↓H␈↓ASSERT FORM(SUBPART, bracket, bracket_bore);
␈↓ ↓H␈↓ASSERT FORM(SUBPART, bracket, bracket_handle);
␈↓ ↓H␈↓ATTACH bracket_bore TO bracket RIGIDLY AT TRANS(ROT(X,180),VECTOR(5.1,2,0));
␈↓ ↓H␈↓ATTACH bracket_handle TO bracket RIGIDLY AT TRANS(ROT(X,180),NILVEC);

␈↓ ↓H␈↓ASSERT FORM(TYPE, bolt, SHAFT);
␈↓ ↓H␈↓ASSERT FORM(DIAMETER, bolt, 0.5*CM);
␈↓ ↓H␈↓ASSERT FORM(TOP_END, bolt, head_type1);
␈↓ ↓H␈↓ASSERT FORM(BOTTOM_END, bolt, tiptype1);
␈↓ ↓H␈↓ASSERT FORM(TYPE, tiptype1, FLAT_END);

␈↓ ↓H␈↓ASSERT FORM(TYPE, bracket_bore, BORE);
␈↓ ↓H␈↓ASSERT FORM(DIAMETER, bracket_bore, 0.502*CM);
␈↓ ↓H␈↓ASSERT FORM(LENGTH, bracket_bore, 0.5*CM);
␈↓ ↓H␈↓ASSERT FORM(TOP_END, bracket_bore, bracket_hole1);
␈↓ ↓H␈↓ASSERT FORM(BOTTOM_END, bracket_bore, bracket_hole1);

␈↓ ↓H␈↓␈↓ αλ␈↓β{Et cetera}

␈↓ ↓H␈↓␈↓β{Also, describe how things go together:}
␈↓ ↓H␈↓ASSERT FORM(TYPE, beam_assembly, ASSEMBLY);
␈↓ ↓H␈↓ASSERT FORM(SUBPART, beam_assembly, beam);
␈↓ ↓H␈↓ASSERT FORM(SUBPART, beam_assembly, bolt);
␈↓ ↓H␈↓ASSERT FORM(SUBPART, beam_assembly, bracket);

␈↓ ↓H␈↓ASSERT FORM(bracket, FITS_ONTO, beam_assembly, AT,
␈↓ ↓H␈↓Page 124␈α?␈α?␈α?␈α?␈α?␈απA `VERY HIGH LEVEL' EXAMPLE␈↓ ≥II.3



␈↓ ↓H␈↓    TRANS(ROT(Y,90),VECTOR(5.1,2,0));
␈↓ ↓H␈↓ASSERT FORM(bolt, FITS_ONTO, beam_assembly, AT,
␈↓ ↓H␈↓    TRANS(ROT(Y,90),VECTOR(5.1,2.3,0));

␈↓ ↓H␈↓ASSERT FORM(MATED, beam_hsurf, bracket_bottom);
␈↓ ↓H␈↓ASSERT FORM(ALIGNED, beam_bore, bracket_bore);
␈↓ ↓H␈↓ASSERT FORM(RUNS_THRU, bolt, bracket_bore);
␈↓ ↓H␈↓ASSERT FORM(RUNS_THRU, bolt, beam_bore);
␈↓ ↓H␈↓␈↓ αλ␈↓β{Et cetera.}

␈↓ ↓H␈↓␈↓β{Now,␈α↔describe␈α⊗the␈α↔initial␈α⊗scene.␈α↔ Here,␈α⊗assume␈α↔that␈α⊗the␈α↔initial␈α⊗object␈α↔locations␈α↔are␈α⊗known
␈↓ ↓H␈↓βprecisely.}
␈↓ ↓H␈↓bracket ← FRAME(NILROT,VECTOR(20,40,0));
␈↓ ↓H␈↓beam ← FRAME(NILROT,VECTOR(10,60,0));
␈↓ ↓H␈↓bolt ← FRAME(ROT(Y,180),VECTOR(30,50,5));

␈↓ ↓H␈↓grasp bracket AT TRANS(ROT(Y,180),2*Z) WITH YELLOW;
␈↓ ↓H␈↓␈↓β{The system will use its internal model of the bracket to fill in the expected hand opening.}

␈↓ ↓H␈↓FIT bracket ONTO beam_assembly
␈↓ ↓H␈↓        USING YELLOW
␈↓ ↓H␈↓        AFTERWARDS HOLD bracket WITH YELLOW;

␈↓ ↓H␈↓␈↓β{The␈α⊃system␈α⊃will␈α⊃use␈α⊃the␈α⊂object␈α⊃description␈α⊃information␈α⊃to␈α⊃fill␈α⊂in␈α⊃the␈α⊃exact␈α⊃location␈α⊃to␈α⊃which␈α⊂to
␈↓ ↓H␈↓βmove␈α↔the␈α⊗bracket.␈α↔ Also,␈α⊗it␈α↔will␈α↔pick␈α⊗appropriate␈α↔techniques␈α⊗to␈α↔ensure␈α⊗that␈α↔the␈α↔bracket␈α⊗is
␈↓ ↓H␈↓βappropriately␈α↔aligned.␈α↔ The␈α⊗AFTERWARDS␈α↔clause␈α↔tells␈α⊗the␈α↔system␈α↔that␈α⊗it␈α↔is␈α↔to␈α↔use␈α⊗the
␈↓ ↓H␈↓βyellow arm to hold the bracket in place}

␈↓ ↓H␈↓INSERT bolt INTO bracket_hole1 USING BLUE;

␈↓ ↓H␈↓␈↓β{Once␈α⊃again,␈α⊃the␈α⊃system␈α⊃will␈α⊃fill␈α⊃in␈α⊃the␈α⊃details,␈α⊃such␈α⊃as␈α⊃how␈α⊃the␈α⊃bolt␈α⊃is␈α⊃to␈α⊃be␈α⊃grasped,␈α∩how␈α⊃it
␈↓ ↓H␈↓βshould be brought to the hole, how it will be pushed in, and so forth.}

␈↓ ↓H␈↓RELEASE bracket; {␈↓βSince the bolt now holds it on.␈↓}
␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α
␈↓ 
RPage 125



␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α≡␈↓∧APPENDIX III␈↓
␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α␈↓¬RUNTIME SYSTEM␈↓

␈↓ ↓H␈↓This␈αappendix␈αdiscusses␈αin␈αgreater␈αdetail␈αsome␈α
of␈αthe␈αaspects␈αof␈αthe␈αruntime␈αsystem,␈αwhich␈α
resides
␈↓ ↓H␈↓on␈α
the␈αPDP11␈α
as␈α
a␈αset␈α
of␈α
programs␈αexecuting␈α
compiled␈αcode,␈α
operating␈α
devices␈αin␈α
real␈α
time␈αand
␈↓ ↓H␈↓receiving sensory input.





␈↓ ↓H␈↓␈↓∧III.1 THE RUNTIME SCHEDULER␈↓

␈↓ ↓H␈↓As␈αmentioned␈αearlier,␈αin␈αChapter␈α5,␈αthe␈αruntime␈αscheduling␈αis␈αmanaged␈αthrough␈αa␈αcombination␈αof
␈↓ ↓H␈↓priority␈αlevel␈αassignments␈αto␈αvarious␈αtypes␈αof␈αprocesses␈αand␈αa␈αtime-slot␈αrequest␈αlist.␈α The␈αPDP-11
␈↓ ↓H␈↓hardware␈α∩provides␈α∩eight␈α∩processor␈α∩priority␈α∩levels.␈α∩ These␈α∩are␈α∩assigned␈α∩in␈α∩the␈α∩'AL␈α∩system␈α⊃as
␈↓ ↓H␈↓follows:
␈↓ ↓H␈↓␈↓ αH7. AD (Analog-to-digital converter), joint servoing
␈↓ ↓H␈↓␈↓ αH6. Clock, calendar
␈↓ ↓H␈↓␈↓ αH5. <spare>
␈↓ ↓H␈↓␈↓ αH4. condition monitors; Interrupt handlers for
␈↓ ↓H␈↓␈↓ αHvarious condition-checking devices (eg finger pads).
␈↓ ↓H␈↓␈↓ αH3. servo predictor
␈↓ ↓H␈↓␈↓ αH2. <spare>
␈↓ ↓H␈↓␈↓ αH1. Interpreters, scheduler for background stuff.
␈↓ ↓H␈↓␈↓ αH0. Interpreters

␈↓ ↓H␈↓The␈α
'AL␈α
system␈αkeeps␈α
a␈α
calendar␈αof␈α
things␈α
that␈α
must␈αbe␈α
done␈α
in␈αeach␈α
time␈α
interval.␈α
 With␈αtime
␈↓ ↓H␈↓slot is associated:
␈↓ ↓H␈↓␈↓ αHa. An AD command list which is to be started.
␈↓ ↓H␈↓␈↓ αHb. A queue of procedure calls to make at various priority levels.

␈↓ ↓H␈↓Typically,␈αa␈αservoing␈αoperation␈αwill␈αhave␈αtwo␈α"phases",␈αone␈αwhich␈αruns␈αat␈αlevel␈α7␈αas␈αa␈αresponse␈αto
␈↓ ↓H␈↓an␈α
AD-done␈αinterrupt␈α
and␈α
which␈αis␈α
responsible␈α
for␈αemitting␈α
the␈α
new␈αdrive,␈α
and␈α
a␈αsomewhat␈α
lower
␈↓ ↓H␈↓priority␈α
one␈α
which␈α
requests␈α
a␈α
new␈α
time␈α
slot␈α
from␈α
the␈α
calendar␈α
management␈α
routine␈α
and␈α
sets␈αup␈α
the
␈↓ ↓H␈↓correction␈α⊂phase␈α⊃for␈α⊂the␈α⊃new␈α⊂slot.␈α⊃ As␈α⊂previously␈α⊂indicated,␈α⊃this␈α⊂first␈α⊃phase␈α⊂is␈α⊃"scheduled"␈α⊂by
␈↓ ↓H␈↓putting␈α
a␈α
pointer␈α
to␈α
the␈α
appropriate␈α
AD␈α
command␈α
list␈α
into␈α
the␈α
"AD␈α
request"␈α
part␈α
of␈α
a␈αcalendar
␈↓ ↓H␈↓time␈αslot.␈α The␈αsecond␈αphase␈αis␈αscheduled␈αmerely␈αby␈αentering␈αit␈αonto␈αthe␈αcalendar␈αqueue␈αof␈αthings
␈↓ ↓H␈↓to be requested in the same tick.  Joint servos are described more fully in the next section.

␈↓ ↓H␈↓If␈αa␈αnon-critical␈αprocess␈α(eg,␈αa␈αcondition␈αmonitor)␈αneeds␈αa␈α"consistent"␈αset␈αof␈αAD␈αmeasurements,␈αit
␈↓ ↓H␈↓can␈α
get␈α
them␈α
by␈αsetting␈α
up␈α
the␈α
appropriate␈αAD␈α
command␈α
list,␈α
finding␈αa␈α
time␈α
slot␈α
for␈α
taking␈αthe
␈↓ ↓H␈↓measurements,␈α∀and␈α∀then␈α∃placing␈α∀a␈α∀request␈α∀that␈α∃the␈α∀computation␈α∀that␈α∀is␈α∃to␈α∀use␈α∀the␈α∃set␈α∀of
␈↓ ↓H␈↓measurements be started up at the time slot after the one in which the measurements are made.

␈↓ ↓H␈↓In␈α
cases␈αwhere␈α
a␈αcommand␈α
list␈αis␈α
too␈αlong␈α
to␈αbe␈α
finished␈αin␈α
one␈αtime␈α
slot,␈αthe␈α
process␈αrequesting
␈↓ ↓H␈↓the␈α⊃measurements␈α⊃must␈α⊃reserve␈α∩two␈α⊃(or␈α⊃more)␈α⊃contiguous␈α⊃slots.␈α∩ This␈α⊃is␈α⊃done␈α⊃by␈α∩placing␈α⊃the
␈↓ ↓H␈↓command␈αlist␈αid␈αin␈αthe␈αfirst␈αslot␈αand␈αa␈αspecial␈αflag␈αvalue␈α(perhaps␈α-1)␈αinto␈αthe␈αremaining␈αslots,␈αso
␈↓ ↓H␈↓that no other processes will try to reserve them.
␈↓ ↓H␈↓Page 126␈α?␈α?␈α?␈α?␈α?␈α,THE RUNTIME SCHEDULER␈↓ ∩III.2



␈↓ ↓H␈↓␈↓∧III.2 TRAJECTORIES␈↓

␈↓ ↓H␈↓A␈α∞trajectory␈α
for␈α∞the␈α
hand␈α∞is␈α
generated␈α∞at␈α
compile␈α∞time␈α
under␈α∞the␈α
assumption␈α∞that␈α∞the␈α
planning
␈↓ ↓H␈↓values␈α⊃for␈α∩the␈α⊃initial␈α⊃point,␈α∩departure␈α⊃point,␈α⊃via␈α∩points,␈α⊃arrival␈α⊃point␈α∩and␈α⊃final␈α∩position␈α⊃are
␈↓ ↓H␈↓accurate.

␈↓ ↓H␈↓If␈α⊂at␈α∂run␈α⊂time␈α∂it␈α⊂is␈α∂found␈α⊂that␈α⊂some␈α∂or␈α⊂all␈α∂of␈α⊂these␈α∂planned␈α⊂positions␈α∂have␈α⊂moved␈α⊂slightly␈α∂it
␈↓ ↓H␈↓becomes␈α
necessary␈α∞to␈α
modify␈α∞the␈α
planned␈α∞trajectory␈α
to␈α
pass␈α∞through␈α
the␈α∞actual␈α
positions.␈α∞ If␈α
the
␈↓ ↓H␈↓actual␈α∞positions␈α
are␈α∞only␈α
slightly␈α∞different␈α∞from␈α
the␈α∞planned␈α
positions␈α∞then␈α
the␈α∞trajectory␈α∞is␈α
still
␈↓ ↓H␈↓almost␈α⊂optimal,␈α⊂that␈α⊂is,␈α∂it␈α⊂still␈α⊂has␈α⊂most␈α∂of␈α⊂the␈α⊂properties␈α⊂with␈α∂which␈α⊂it␈α⊂was␈α⊂designed.␈α⊂ If␈α∂the
␈↓ ↓H␈↓deviation␈αfrom␈αthe␈αplanned␈αvalues␈αto␈αthe␈αactual␈α
are␈αgreat␈αthen␈αthe␈αtrajectory␈αis␈αno␈αlonger␈α
optimal.
␈↓ ↓H␈↓To␈αplan␈αa␈αnew␈αtrajectory␈αwould␈αagain␈αoptimize␈α
the␈αmove,␈αbut␈αonly␈αif␈αthe␈αtime␈αto␈αcompute␈α
is␈αless
␈↓ ↓H␈↓than␈αthe␈α
time␈αsaved␈α
is␈αit␈α
worth␈αrecomputing.␈α At␈α
present␈αthis␈α
is␈αnot␈α
the␈αcase,␈α
so␈αno␈αrecalculation␈α
of
␈↓ ↓H␈↓trajectories is done.  Instead, the following trajectory modification step is performed:

␈↓ ↓H␈↓Before␈α∪the␈α∩move␈α∪is␈α∩executed,␈α∪it␈α∩is␈α∪prepared␈α∩by␈α∪computing␈α∩the␈α∪discrepancies␈α∪between␈α∩actual
␈↓ ↓H␈↓locations␈α⊂and␈α⊂planned␈α⊃locations.␈α⊂ Fifth␈α⊂degree␈α⊂interpolating␈α⊃polynomials␈α⊂(with␈α⊂zero␈α⊃initial␈α⊂and
␈↓ ↓H␈↓final␈α
velocity␈αand␈α
acceleration)␈α
are␈αcomputed␈α
to␈α
be␈αadded␈α
into␈α
the␈αplanned␈α
polynomials␈α
to␈αbring
␈↓ ↓H␈↓the␈αplanned␈αtrajectory␈αinto␈αline␈αwith␈αreality.␈α The␈αjoint␈αangles␈αassociated␈αwith␈αa␈αframe␈αare␈αstored
␈↓ ↓H␈↓along␈αwith␈αits␈αmatrix,␈αso␈αthis␈αoften␈αdoes␈αnot␈αinvolve␈αmuch␈αcalculation,␈αunless␈αthe␈αframe␈αhas␈αbeen
␈↓ ↓H␈↓changed␈α∞since␈α∞these␈α∞calculations␈α∞were␈α∞done␈α∞last.␈α∞Also␈α∞at␈α∞this␈α∞time␈α∞the␈α∞joint␈α∞inertias␈α∂and␈α∞gravity
␈↓ ↓H␈↓loadings are calculated and stored in the value cell of relevant frames.





␈↓ ↓H␈↓␈↓∧III.3 JOINT SERVOING␈↓

␈↓ ↓H␈↓Any␈αcoordinated␈αmotion␈αof␈αthe␈αarm␈αcan␈αbe␈α
expressed␈αas␈αsix␈αtime␈αdependent␈αmotions,␈αone␈αfor␈α
each
␈↓ ↓H␈↓joint;␈α∂the␈α∞coordinated␈α∂motion␈α∞is␈α∂parameterized␈α∂in␈α∞terms␈α∂of␈α∞time.␈α∂ The␈α∞problem␈α∂of␈α∂servoing␈α∞the
␈↓ ↓H␈↓arm, or arms, is thus reduced to a problem of servoing a number of joints with respect to time.

␈↓ ↓H␈↓A␈α
joint␈α
servo␈α
has␈α
two␈α
parts:␈α
a␈α
drive␈α
part␈α
and␈α
a␈α
predictor␈α
part.␈α
As␈α
mentioned␈α
before,␈α
the␈α
drive␈α
part
␈↓ ↓H␈↓is␈α
run␈α
at␈α
priority␈α
level␈α
7.␈α
 When␈α
it␈αfinishes,␈α
the␈α
servo␈α
enters␈α
priority␈α
level␈α
3␈α
for␈α
the␈αpredictor.␈α
First,
␈↓ ↓H␈↓the␈α⊃predictor␈α⊃reserves␈α⊃a␈α∩time␈α⊃for␈α⊃the␈α⊃next␈α∩run␈α⊃of␈α⊃this␈α⊃servo.␈α∩The␈α⊃delay␈α⊃is␈α⊃chosen␈α∩based␈α⊃on
␈↓ ↓H␈↓considerations of joint response time, joint velocity, and availability of time slots.

␈↓ ↓H␈↓Now␈α⊂the␈α∂predictor␈α⊂evaluates␈α∂the␈α⊂motion␈α∂polynomial␈α⊂for␈α∂the␈α⊂time␈α∂which␈α⊂it␈α∂has␈α⊂reserved.␈α∂ This
␈↓ ↓H␈↓evaluation␈α⊃may␈α⊃take␈α⊃into␈α⊃account␈α∩an␈α⊃interpolating␈α⊃polynomial␈α⊃used␈α⊃for␈α∩last-minute␈α⊃trajectory
␈↓ ↓H␈↓modification,␈α⊃as␈α⊃well␈α⊃as␈α⊃any␈α⊃offset␈α⊃that␈α⊂might␈α⊃be␈α⊃necessary␈α⊃due␈α⊃to␈α⊃modifications␈α⊃being␈α⊂made
␈↓ ↓H␈↓during␈α
the␈α
motion␈α
itself.␈α∞These␈α
calculations␈α
give␈α
the␈α∞predicted␈α
set␈α
point.␈α
 The␈α∞predicted␈α
velocity
␈↓ ↓H␈↓and␈α
acceleration␈α
are␈α
obtained␈α
by␈α
difference␈α
techniques␈α
based␈α
on␈α
recent␈α
set␈α
point␈α
values.␈α The␈α
joint
␈↓ ↓H␈↓inertia␈αand␈α
gravity␈αforce␈α
loading␈αare␈α
interpolated.␈α The␈α
gravity␈αloading␈α
is␈αadded␈α
to␈αthe␈αproduct␈α
of
␈↓ ↓H␈↓the predicted acceleration and the joint inertia to yield a predicted drive.

␈↓ ↓H␈↓If␈α∀this␈α∪joint␈α∀has␈α∀multiple␈α∪wipers␈α∀then␈α∪the␈α∀appropriate␈α∀wiper␈α∪to␈α∀read␈α∪the␈α∀joint␈α∀position␈α∪is
␈↓ ↓H␈↓determined.␈α∃ Then␈α∃the␈α∃joint␈α∃calibration␈α∃is␈α∃applied␈α∃to␈α∃the␈α∃set␈α∃point␈α∃to␈α∃yield␈α∃the␈α∃expected
␈↓ ↓H␈↓III.3␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α∀JOINT SERVOING␈↓ 
RPage 127



␈↓ ↓H␈↓potentiometer␈α
reading␈αfor␈α
the␈αjoint␈α
at␈αthe␈α
reserved␈αtime.␈α
The␈αservo␈α
gains,␈αwhich␈α
are␈αdependent␈α
on
␈↓ ↓H␈↓joint␈α∞inertia,␈α∞are␈α∞next␈α∞calculated,␈α∂and␈α∞finally␈α∞the␈α∞servo␈α∞equation␈α∂is␈α∞set␈α∞up␈α∞in␈α∞terms␈α∂of␈α∞observed
␈↓ ↓H␈↓position␈αand␈αvelocity.␈α The␈αform␈α
of␈αthe␈αservo␈αequation␈αis␈α
dependent␈αon␈αwhether␈αthe␈αjoint␈αis␈α
being
␈↓ ↓H␈↓run␈α∂with␈α∂position,␈α⊂velocity,␈α∂or␈α∂force␈α⊂servoing.␈α∂ Having␈α∂done␈α∂all␈α⊂this␈α∂predictive␈α∂work,␈α⊂the␈α∂joint
␈↓ ↓H␈↓servo dismisses control.

␈↓ ↓H␈↓When␈α
the␈α
reserved␈α
time␈α
occurs,␈αthe␈α
drive␈α
part␈α
of␈α
the␈α
servo␈αruns␈α
in␈α
priority␈α
level␈α
7.␈α
The␈αdrive␈α
part
␈↓ ↓H␈↓measures␈α
the␈α
position␈α
and␈αvelocity,␈α
evaluates␈α
the␈α
servo␈αequation␈α
prepared␈α
by␈α
the␈αpredictor,␈α
applies
␈↓ ↓H␈↓friction␈α
compensation␈α
and␈α∞drives␈α
the␈α
joint.␈α∞ This␈α
is␈α
a␈α
very␈α∞fast␈α
computation␈α
and␈α∞minimizes␈α
any
␈↓ ↓H␈↓delay␈α∩between␈α∩observation␈α∩and␈α∩action.␈α∩ The␈α∩predictor␈α∩is␈α∩then␈α∩run␈α∩again␈α∩for␈α∩the␈α∩next␈α∩servo
␈↓ ↓H␈↓scheduling, as described above.

␈↓ ↓H␈↓Upon␈α
completion␈αof␈α
the␈α
motion,␈αor␈α
if␈α
some␈αerror␈α
should␈αoccur,␈α
or␈α
if␈αsome␈α
other␈α
process␈αrequests
␈↓ ↓H␈↓that the joint stop, completion codes are set for the joint, and then the servo terminates.

␈↓ ↓H␈↓The␈αadvantage␈αof␈αthis␈αservo␈αscheme␈αis␈αthat␈αit␈αallows␈αflexible␈αscheduling:␈αeach␈αjoint␈αcan␈αrun␈αat␈αits
␈↓ ↓H␈↓own␈α
required␈α
repetition␈α
rate.␈α
 As␈α
the␈αjoint␈α
knows␈α
when␈α
it␈α
will␈α
be␈αrun␈α
next␈α
it␈α
is␈α
possible␈α
to␈αpre-
␈↓ ↓H␈↓compute most of the drive and thus reduce the servo delay.

␈↓ ↓H␈↓Each␈α
servo␈α
routine␈α
has␈α
a␈α
control␈α
block␈α
which␈αincludes␈α
a␈α
status␈α
register.␈α
In␈α
the␈α
case␈α
of␈α
a␈αjoint␈α
servo
␈↓ ↓H␈↓the status register contains the following bits:

␈↓ ↓H␈↓        RUN             joint is running or about to be run
␈↓ ↓H␈↓        FIRST           first time through loop for this motion.
␈↓ ↓H␈↓        FINAL           in final state, nulling errors
␈↓ ↓H␈↓        STOP            stop this joint, or joint is stopped
␈↓ ↓H␈↓        EXFORCE         joint stopped due to excessive force.
␈↓ ↓H␈↓        ADERR           a/d error
␈↓ ↓H␈↓        NONEX           joint is down or does not exist
␈↓ ↓H␈↓        STERR           servo was not run on schedule
␈↓ ↓H␈↓        SERVO           position servo
␈↓ ↓H␈↓        VELS            velocity servo
␈↓ ↓H␈↓        FORCE           exert force
␈↓ ↓H␈↓        WOB             perturb this joint while running
␈↓ ↓H␈↓        NUL             null errors at end and stop


␈↓ ↓H␈↓When␈α
the␈α
servo␈α
is␈α
started␈α
up␈α
for␈α
the␈α
first␈α
time,␈α
it␈α
is␈α
given␈α
certain␈α
information,␈α
including␈α
which
␈↓ ↓H␈↓joint␈α∩it␈α∩should␈α∩servo,␈α∪what␈α∩the␈α∩properties␈α∩of␈α∩that␈α∪joint␈α∩are,␈α∩what␈α∩polynomial␈α∩to␈α∪follow,␈α∩the
␈↓ ↓H␈↓predicted gravity torque and inertia loadings.

␈↓ ↓H␈↓This␈α∂system␈α∂allows␈α∂us␈α∞to␈α∂move␈α∂the␈α∂arm␈α∂and␈α∞to␈α∂carry␈α∂loads;␈α∂it␈α∞is␈α∂possible␈α∂to␈α∂exert␈α∂forces␈α∞along
␈↓ ↓H␈↓various␈α∂free␈α∞directions.␈α∂The␈α∞system␈α∂as␈α∞it␈α∂is␈α∞described␈α∂here␈α∞is␈α∂incapable␈α∞of␈α∂interacting␈α∂with␈α∞live
␈↓ ↓H␈↓loads, springs, partially submerged objects and other objects with complex reactions to forces.
␈↓ ↓H␈↓Page 128␈α?␈α?␈α?␈α?␈α?␈α?␈α
INTERPRETABLE CODE␈↓ ∩III.4



␈↓ ↓H␈↓␈↓∧III.4 INTERPRETABLE CODE␈↓

␈↓ ↓H␈↓The␈α∂runtime␈α∂interpreters␈α∞act␈α∂by␈α∂interpreting␈α∂a␈α∞special␈α∂kind␈α∂of␈α∞code␈α∂generated␈α∂by␈α∂the␈α∞compiler.
␈↓ ↓H␈↓The␈α⊂␈↓βpseudo␈α⊂operations␈↓␈α⊂available␈α⊂include␈α⊂stack␈α⊂manipulation,␈α⊂flow-of-control␈α⊃primitives,␈α⊂device
␈↓ ↓H␈↓control,␈α∞and␈α∞arithmetic.␈α∂ Arithmetic␈α∞routines␈α∞always␈α∞take␈α∂their␈α∞arguments␈α∞from␈α∞the␈α∂stack,␈α∞which
␈↓ ↓H␈↓contains␈α∂pointers␈α⊂to␈α∂value␈α⊂cells.␈α∂ Variables␈α⊂are␈α∂accessed␈α⊂through␈α∂␈↓βenvironments␈↓:␈α⊂an␈α∂environment
␈↓ ↓H␈↓points␈αto␈αall␈αthe␈αvariables␈αlocal␈αto␈αa␈αparticular␈αblock␈αlevel␈αand␈αalso␈αto␈αthe␈αenvironment␈αin␈αforce␈αat
␈↓ ↓H␈↓the␈αnext␈αglobal␈αlevel.␈α When␈αone␈αinterpreter␈αsprouts␈αseveral␈αsubsidiary␈αinterpreters␈α(to␈αimplement
␈↓ ↓H␈↓a␈αsimultaneous␈αblock,␈αfor␈αexample),␈αeach␈αnew␈αinterpreter␈αgets␈αa␈αnew␈αenvironment␈αwhich␈αpoints␈αto
␈↓ ↓H␈↓the old one; thus they all share global information.

␈↓ ↓H␈↓Arguments are stored immediately after those pseudo-instructions which need them.

␈↓ ↓H␈↓Here is a list of the pseudo-operations currently available:


␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α(STACK OPERATORS 
␈↓ ↓H␈↓gtval <arg> ␈↓ βHThe␈α⊗argument␈α⊗has␈α⊗two␈α⊗fields:␈α⊗lexical␈α⊗level␈α⊗and␈α⊗offset.␈α⊗ Together,␈α⊗these
␈↓ ↓H␈↓␈↓ βHdetermine␈αa␈αvariable.␈α The␈αvalue␈αof␈αthat␈αvariable␈αis␈αextracted␈αfrom␈αthe␈αgraph
␈↓ ↓H␈↓␈↓ βHstructure and a pointer to it is placed on the stack.
␈↓ ↓H␈↓chnge <arg> ␈↓ βHThe␈α
argument␈α
again␈α
determines␈α
a␈αvariable.␈α
 The␈α
value␈α
currently␈α
pointed␈αto␈α
by
␈↓ ↓H␈↓␈↓ βHthe␈αtop␈αof␈αthe␈αstack␈αis␈αstored␈αinto␈αthat␈αvariable,␈αand␈αall␈αnecessary␈αupdating␈αof
␈↓ ↓H␈↓␈↓ βHthe graph structure is performed.
␈↓ ↓H␈↓pop ␈↓ βHpops the stack.
␈↓ ↓H␈↓copy <num> ␈↓ βHfinds␈αthe␈α
<num>'th␈αelement␈α
down␈αin␈α
the␈αstack␈α(this␈α
will␈αbe␈α
a␈αpointer␈α
to␈αsome
␈↓ ↓H␈↓␈↓ βHvalue cell) and copy it to the top.
␈↓ ↓H␈↓copys ␈↓ βHmake␈α
a␈α
new␈α
scalar␈αvalue␈α
cell;␈α
initialize␈α
it␈α
to␈αthe␈α
same␈α
value␈α
as␈α
the␈αcell␈α
currently
␈↓ ↓H␈↓␈↓ βHpointed to by the top of the stack, and push it.
␈↓ ↓H␈↓copyv ␈↓ βHmake␈α∪a␈α∪new␈α∩vector␈α∪value␈α∪cell;␈α∪initialize␈α∩it␈α∪to␈α∪the␈α∩same␈α∪value␈α∪as␈α∪the␈α∩cell
␈↓ ↓H␈↓␈↓ βHcurrently pointed to by the top of the stack, and push it.
␈↓ ↓H␈↓copyr ␈↓ βHmake␈α
a␈α
new␈αrot␈α
value␈α
cell;␈αinitialize␈α
it␈α
to␈αthe␈α
same␈α
value␈αas␈α
the␈α
cell␈αcurrently
␈↓ ↓H␈↓␈↓ βHpointed to by the top of the stack, and push it.
␈↓ ↓H␈↓copyf ␈↓ βHmake␈α
a␈α
new␈α
frame␈α
value␈α
cell;␈α
initialize␈α
it␈α
to␈α
the␈α
same␈α
value␈α
as␈α
the␈αcell␈α
currently
␈↓ ↓H␈↓␈↓ βHpointed to by the top of the stack, and push it.
␈↓ ↓H␈↓copyp ␈↓ βHmake␈α
a␈αnew␈α
plane␈αvalue␈α
cell;␈α
initialize␈αit␈α
to␈αthe␈α
same␈α
value␈αas␈α
the␈αcell␈α
currently
␈↓ ↓H␈↓␈↓ βHpointed to by the top of the stack, and push it.
␈↓ ↓H␈↓copyt ␈↓ βHmake␈αa␈αnew␈αtrans␈αvalue␈α
cell;␈αinitialize␈αit␈αto␈αthe␈α
same␈αvalue␈αas␈αthe␈αcell␈α
currently
␈↓ ↓H␈↓␈↓ βHpointed to by the top of the stack, and push it.
␈↓ ↓H␈↓flush ␈↓ βHclears the stack.

␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α ARITHMETIC 

␈↓ ↓H␈↓Arithmetic␈α∞routines␈α∞are␈α∞supplied␈α∞for␈α∞all␈α∞the␈α∞operations␈α∞described␈α∞in␈α∞subsection␈α∞2.1.9.␈α∞ The␈α
stack
␈↓ ↓H␈↓contains␈α∂pointers␈α∂to␈α∂the␈α∞value␈α∂cells␈α∂needed␈α∂as␈α∂arguments.␈α∞ After␈α∂the␈α∂operation␈α∂is␈α∂completed,␈α∞all
␈↓ ↓H␈↓argument␈α
pointers␈αare␈α
popped␈αfrom␈α
the␈αstack,␈α
and␈αa␈α
pointer␈αto␈α
the␈αresult␈α
value␈αcell␈α
is␈αpushed␈α
onto
␈↓ ↓H␈↓the stack.

␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α&FLOW OF CONTROL 
␈↓ ↓H␈↓III.4␈α?␈α?␈α?␈α?␈α?␈α?␈α%INTERPRETABLE CODE␈↓ 
RPage 129



␈↓ ↓H␈↓proc ␈↓ βHProcedure␈α
call;␈α
takes␈α∞as␈α
arguments␈α
the␈α∞destination␈α
address,␈α
the␈α∞argument␈α
list.
␈↓ ↓H␈↓␈↓ βHAll value parameters should first have been copied into temps.
␈↓ ↓H␈↓return ␈↓ βHProcedure return
␈↓ ↓H␈↓sprout ␈↓ βHStart␈α
up␈αa␈α
new␈αinterpreter.␈α
 The␈αsingle␈α
argument␈αtells␈α
where␈αits␈α
code␈αis␈α
to␈αbe
␈↓ ↓H␈↓␈↓ βHfound.
␈↓ ↓H␈↓enable <arg> ␈↓ βHstart up an on-monitor with location of status word <arg>.
␈↓ ↓H␈↓disable <arg> ␈↓ βHthe on-monitor with location of status word <arg> is disabled.
␈↓ ↓H␈↓wait ␈↓ βHwait␈α∩until␈α∩all␈α∩descendant␈α∩(non␈α∩on-monitor)␈α∩processes␈α∩are␈α∩dead.␈α∩ Then␈α⊃kill
␈↓ ↓H␈↓␈↓ βHdescendant move on-monitors and continue.
␈↓ ↓H␈↓terminate ␈↓ βHterminate this process.  Should first call "wait".
␈↓ ↓H␈↓jump <arg> ␈↓ βHunconditional jump to indicated location in interpreter code.
␈↓ ↓H␈↓jumpp <arg> ␈↓ βHconditional jump on positive element at top of stack.
␈↓ ↓H␈↓jumpz <arg> ␈↓ βHconditional jump on zero element at top of stack.
␈↓ ↓H␈↓nop ␈↓ βHno-op.

␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α"ARM AND DEVICE CONTROL 
␈↓ ↓H␈↓prepmove <arg> ␈↓ βH<arg> points to the move vector.  Trajectory modification happens now.
␈↓ ↓H␈↓startmove ␈↓ βHsprouts joint servos and move-monitors
␈↓ ↓H␈↓search <arg> ␈↓ βH<arg> points to the search vector.
␈↓ ↓H␈↓stop <arg> ␈↓ βH<arg> encoding of what devices must be stopped.

␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α!INPUT AND OUTPUT 

␈↓ ↓H␈↓Some␈αsort␈αof␈αI/O␈αwill␈αbe␈αimplemented,␈αmost␈αlikely␈αincluding␈αstring␈αoutput␈αto␈αthe␈αsupervisor,␈αerror
␈↓ ↓H␈↓message output, and input (from supervisor or from coresident routines) of value cells.

␈↓ ↓H␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α;DEBUGGING AIDS 
␈↓ ↓H␈↓source <arg> ␈↓ βHnotes that <arg> is where the interpreter is now in source code.
␈↓ ↓H␈↓tellsource ␈↓ βHoutput current source location to the 10.
␈↓ ↓H␈↓step ␈↓ βHbegins␈αstep␈αmode,␈αwhich␈αdoes␈αone␈αinterpretation␈αat␈αa␈αtime,␈αrequires␈αmessage␈αto
␈↓ ↓H␈↓␈↓ βHcontinue.
␈↓ ↓H␈↓offstep ␈↓ βHturns off step mode; normal speed is resumed.





␈↓ ↓H␈↓␈↓∧III.5 ALGORITHMS FOR USE OF GRAPH STRUCTURE␈↓

␈↓ ↓H␈↓These␈α
are␈α
the␈α
algorithms␈α∞(written␈α
in␈α
an␈α
Algol-like␈α
fashion)␈α∞used␈α
to␈α
find␈α
values␈α
for␈α∞variables␈α
in
␈↓ ↓H␈↓the graph structure and to change those values.
␈↓ ↓H␈↓Page 130␈α?␈α?␈α?␈αALGORITHMS FOR USE OF GRAPH STRUCTURE␈↓ ∩III.5



␈↓ ↓H␈↓PROCEDURE invalidate (POINTER(NODE) n);
␈↓ ↓H␈↓        IF invmark(n)=0 THEN
␈↓ ↓H␈↓                BEGIN  COMMENT:  This cell currently marked valid;
␈↓ ↓H␈↓                POINTER p;
␈↓ ↓H␈↓                invmark(n)← -1;
␈↓ ↓H␈↓                p ← dependents(n);
␈↓ ↓H␈↓                WHILE p␈↓ε≠␈↓NULL DO
␈↓ ↓H␈↓                        BEGIN  COMMENT: Mark all dependents as invalid;
␈↓ ↓H␈↓                        invalidate(p);
␈↓ ↓H␈↓                        p ← link(p)
␈↓ ↓H␈↓                        END
␈↓ ↓H␈↓                END;



␈↓ ↓H␈↓PROCEDURE change (POINTER(NODE) n; POINTER(VALUE) vnew);
␈↓ ↓H␈↓        BEGIN
␈↓ ↓H␈↓        COMMENT:  This procedure is called in order to explicitly assign
␈↓ ↓H␈↓                a new value, vnew, to node n;
␈↓ ↓H␈↓        POINTER(VALUE) vold;
␈↓ ↓H␈↓        invalidate(n);
␈↓ ↓H␈↓        vold ← value(n);
␈↓ ↓H␈↓        value(n)←vnew;
␈↓ ↓H␈↓        p ← changer(n);
␈↓ ↓H␈↓        WHILE p␈↓ε≠␈↓NULL DO
␈↓ ↓H␈↓                BEGIN  COMMENT:  Handle all changers;
␈↓ ↓H␈↓                APPLY(code(p),vold,vnew);
␈↓ ↓H␈↓                p ← link(p);
␈↓ ↓H␈↓                END;
␈↓ ↓H␈↓        invmark(n) ← 0;
␈↓ ↓H␈↓        END;



␈↓ ↓H␈↓POINTER(VALUE) PROCEDURE getvalue (POINTER(NODE) n);
␈↓ ↓H␈↓        BEGIN
␈↓ ↓H␈↓        IF invmark(n)␈↓ε≠␈↓0 THEN evalnode(n, time ← time+1);
␈↓ ↓H␈↓        RETURN(value(n));
␈↓ ↓H␈↓        END;
␈↓ ↓H␈↓III.5␈α?␈α?␈α?␈α$ALGORITHMS FOR USE OF GRAPH STRUCTURE␈↓ 
RPage 131



␈↓ ↓H␈↓PROCEDURE evalnode (POINTER(NODE) n, INTEGER t);
␈↓ ↓H␈↓        BEGIN  COMMENT:  Put a good value in the value cell of n.
␈↓ ↓H␈↓                t is used to break cycles;
␈↓ ↓H␈↓        IF invmark(n)=0 ∨ invmark(n)=t THEN RETURN;
␈↓ ↓H␈↓        invmark(n) ← t;
␈↓ ↓H␈↓        p ← calculator(n);
␈↓ ↓H␈↓        WHILE p ␈↓ε≠␈↓ NULL DO
␈↓ ↓H␈↓                BEGIN "cloop"
␈↓ ↓H␈↓                POINTER(node) d;
␈↓ ↓H␈↓                d ← needed(p);
␈↓ ↓H␈↓                WHILE d ␈↓ε≠␈↓ NULL DO
␈↓ ↓H␈↓                        BEGIN
␈↓ ↓H␈↓                        evalnode(node(d),t);
␈↓ ↓H␈↓                        IF invmark(dep(d))␈↓ε≠␈↓0 THEN
␈↓ ↓H␈↓                                BEGIN
␈↓ ↓H␈↓                                p ← next(p);
␈↓ ↓H␈↓                                CONTINUE "cloop";
␈↓ ↓H␈↓                                END;
␈↓ ↓H␈↓                        d ← next(d);
␈↓ ↓H␈↓                        END;
␈↓ ↓H␈↓                value(n)←APPLY(code(p), args(p));
␈↓ ↓H␈↓                invmark(n)←0;
␈↓ ↓H␈↓                RETURN;
␈↓ ↓H␈↓                END;
␈↓ ↓H␈↓        END;